WIP: feat(vk): add AMD FSR 4 Frame Generation (MLFI 4.0.2) #2831

Draft
nwgat wants to merge 7 commits from nwgat/Longshot:feat/fsr4-framegen into main
First-time contributor

Summary

Adds standalone AMD FSR 4 Frame Generation (ML Frame Interpolation 4.0.2) via the AMD FidelityFX SDK v2.4.0 (amd_fidelityfx_loader_vk.dll + amd_fidelityfx_framegeneration_vk.dll) on supported AMD GPUs, plus 10-bit PQ Native HDR support (A2B10G10R10_UNORM_PACK32) integrated with Longshot's Native HDR framegen buffers.

  • Runs directly on the replay command buffer without FFX's proxy swapchain (FFX_FRAMEGENERATION_FLAG_NO_SWAPCHAIN_CONTEXT_NOTIFY), executing ffxConfigure → ffxDispatchDescFrameGenerationPrepareV2 (with reversed depth, render-pixel actor motion, and world-space camera basis from vk_fsr3_inputs) → ffxDispatchDescFrameGeneration (numGeneratedFrames = 1, up to 2×).
  • Works with any upscaler (FSR 4, FSR 3.1, XeSS, DLSS, Game, or Off) and supports both Fixed 2× and Auto modes.
  • Switching Frame generation to Auto on a GPU where FSR 4 FG is available automatically selects FSR 4 FG (opts.framegen_by = 3) and enables AMD Anti-Lag 2 (opts.antilag = 1, synced via menu_antilag_changed), while keeping both rows manually overridable.
  • Reuses Longshot's 10-bit PQ framegen buffers (color_format) in Native HDR and composites crisp 10-bit PQ HUD pixels onto generated frames via shaders/fg_hud_fsr4_pq.comp (and the learned HUD layer hud.over_pipe / hud.over_pipe_rgba8 in SDR).
  • RX_VK_FSR4_FG=0|1 forbids or forces FSR 4 FG for a run; DLSS FG (NGX and Streamline) and XeSS paths are untouched.

Files to read first: gpu/vk/vk_fsr4_fg.h, gpu/vk/vk_fsr4_fg.cpp, gpu/vk/vk_framegen.cpp, gpu/vk/menu/framegen.cpp, gpu/vk/fsr3_math.h, gpu/vk/framegen_rows.h, and tests/test_fsr4_fg.py.

Testing

Tested:

  • Hardware / OS: Windows 11, AMD Radeon RX 9070 XT (RDNA 4), Adrenalin 26.11.2 (LLPC), Ryzen 9 5900X, 3840×2160 @ 120 Hz.
  • In-game: Loaded 3D gameplay with FSR 4 4.1.2 + FSR 4 FG 4.0.2 (providers 4.0.2, 3.1.6; using 4.0.2), verified context creation and frame generation in SDR and Native HDR PQ.
  • Checks (rebased onto main @ cb0a2763):
    • Passed: test_fsr4_fg.py, test_framegen_by_row.py, test_framegen_dlss_cap.py, test_pacing_policy.py, test_menu_i18n.py (14/14), test_menu_i18n_count.py, test_menu_ini_keys.py, test_pass_barrier.py, test_fsr3fi_hud_mask.py, test_antilag.py, test_framegen_fixed_pace.py.
    • Syntax/compile checked (g++ -std=c++20) both with and without -DLONGSHOT_FSR: vk_framegen.cpp, vk_temporal.cpp, menu/framegen.cpp, vk_fsr4_fg.cpp, vk_fsr3_inputs.cpp.

Still to test:

  • Windows AMD RDNA 4 (rebased head d84c9d8b): re-verify in-game SDR, Native HDR PQ (10-bit HUD composite), Auto mode (with Anti-Lag 2 auto-enable), and Fixed 2× after the main @ cb0a2763 rebase (by hand).
  • Windows NVIDIA RTX 40/50 (NGX & Streamline DLSS FG): verify DLSS FG menu stepping, Streamline restart flow, and zero regressions (@Beanstalk / by hand).
  • Linux Mesa RADV / Intel Arc / non-RDNA4 AMD: verify clean probe fallback (FSR4_FG_SKIP_NO_LIBRARY / FSR4_FG_SKIP_NO_MODEL) and builds without --upscaler fsr4 (@Beanstalk / CI).

Measurements

Verdict: Pending — interleaved A/B frame-time and pacing measurements against main @ cb0a2763 (FSR 4 FG 2× vs FSR 3.1 FG 2× vs FG Off in SDR and Native HDR) still to be recorded while in WIP.

Setup: Windows 11, AMD Radeon RX 9070 XT, Adrenalin 26.11.2, 3840×2160 @ 120 Hz.

Before: main @ cb0a2763 After: this PR @ d84c9d8b
Frame rate / GPU time / pacing TBD TBD

Risks

  • Adds MIT-licensed AMD FidelityFX SDK v2.4.0 frame-generation headers (third_party/fidelityfx/framegeneration/include/ffx_framegeneration*.h); no AMD binaries ship with Longshot.
  • RX_VK_FSR4_FG=0 disables FSR 4 FG completely for a run; reverting the branch restores main with no save, cache, or longshot_options.ini incompatibility (an older ini's frame_generation_by=0 stays FSR 3.1 FG / DLSS FG).
  • Needs re-verification in-game on d84c9d8b after adapting to upstream's 10-bit Native HDR (3f94da5d), Streamline (6e6f1160, 450e63b8), and 45 FPS cap (53607d0d) changes.

Checklist

Ready for review

  • One topic, on current main (cb0a2763); the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (Ran earlier pre-rebase build on RX 9070 XT; needs quick re-run on rebased d84c9d8b.)
  • mise run test passes (any failure that also fails on main is named). (Targeted unit tests passed; full mise run test not yet run.)
  • Measured against main, or Measurements says why there is nothing to measure. (Interleaved measurements TBD in WIP.)
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible. (Note: adds MIT-licensed FFX SDK 2.4.0 headers under third_party/fidelityfx/framegeneration/include/ with PROVENANCE.md / README.md / scripts/fetch.py / mise.lock updated.)

When it applies

  • A switch added or changed: RX_VK_FSR4_FG added with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • The SPIR-V headers regenerated (gpu/vk/shaders/fg_hud_fsr4_pq_comp_spv.h).
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Compiled with MinGW g++ on Windows; Linux build pending CI.)
  • Screenshots of the same spot on main and here, for a change that shows on screen. (Pending in-game capture on d84c9d8b.)
  • Docs updated (docs/dev/reference/upscalers.md, docs/user/graphics-and-controls.md).

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary Adds standalone **AMD FSR 4 Frame Generation (ML Frame Interpolation 4.0.2)** via the AMD FidelityFX SDK v2.4.0 (`amd_fidelityfx_loader_vk.dll` + `amd_fidelityfx_framegeneration_vk.dll`) on supported AMD GPUs, plus 10-bit PQ Native HDR support (`A2B10G10R10_UNORM_PACK32`) integrated with Longshot's Native HDR framegen buffers. - Runs directly on the replay command buffer without FFX's proxy swapchain (`FFX_FRAMEGENERATION_FLAG_NO_SWAPCHAIN_CONTEXT_NOTIFY`), executing `ffxConfigure` → `ffxDispatchDescFrameGenerationPrepareV2` (with reversed depth, render-pixel actor motion, and world-space camera basis from `vk_fsr3_inputs`) → `ffxDispatchDescFrameGeneration` (`numGeneratedFrames = 1`, up to 2×). - Works with any upscaler (FSR 4, FSR 3.1, XeSS, DLSS, Game, or Off) and supports both **Fixed 2×** and **Auto** modes. - Switching **Frame generation** to **Auto** on a GPU where FSR 4 FG is available automatically selects **FSR 4 FG** (`opts.framegen_by = 3`) and enables **AMD Anti-Lag 2** (`opts.antilag = 1`, synced via `menu_antilag_changed`), while keeping both rows manually overridable. - Reuses Longshot's 10-bit PQ framegen buffers (`color_format`) in Native HDR and composites crisp 10-bit PQ HUD pixels onto generated frames via `shaders/fg_hud_fsr4_pq.comp` (and the learned HUD layer `hud.over_pipe` / `hud.over_pipe_rgba8` in SDR). - `RX_VK_FSR4_FG=0|1` forbids or forces FSR 4 FG for a run; DLSS FG (NGX and Streamline) and XeSS paths are untouched. Files to read first: `gpu/vk/vk_fsr4_fg.h`, `gpu/vk/vk_fsr4_fg.cpp`, `gpu/vk/vk_framegen.cpp`, `gpu/vk/menu/framegen.cpp`, `gpu/vk/fsr3_math.h`, `gpu/vk/framegen_rows.h`, and `tests/test_fsr4_fg.py`. ## Testing **Tested:** - **Hardware / OS:** Windows 11, AMD Radeon RX 9070 XT (RDNA 4), Adrenalin 26.11.2 (LLPC), Ryzen 9 5900X, 3840×2160 @ 120 Hz. - **In-game:** Loaded 3D gameplay with FSR 4 4.1.2 + FSR 4 FG 4.0.2 (`providers 4.0.2, 3.1.6; using 4.0.2`), verified context creation and frame generation in SDR and Native HDR PQ. - **Checks (rebased onto `main @ cb0a2763`):** - Passed: `test_fsr4_fg.py`, `test_framegen_by_row.py`, `test_framegen_dlss_cap.py`, `test_pacing_policy.py`, `test_menu_i18n.py` (14/14), `test_menu_i18n_count.py`, `test_menu_ini_keys.py`, `test_pass_barrier.py`, `test_fsr3fi_hud_mask.py`, `test_antilag.py`, `test_framegen_fixed_pace.py`. - Syntax/compile checked (`g++ -std=c++20`) both with and without `-DLONGSHOT_FSR`: `vk_framegen.cpp`, `vk_temporal.cpp`, `menu/framegen.cpp`, `vk_fsr4_fg.cpp`, `vk_fsr3_inputs.cpp`. **Still to test:** - Windows AMD RDNA 4 (rebased head `d84c9d8b`): re-verify in-game SDR, Native HDR PQ (10-bit HUD composite), Auto mode (with Anti-Lag 2 auto-enable), and Fixed 2× after the `main @ cb0a2763` rebase (by hand). - Windows NVIDIA RTX 40/50 (NGX & Streamline DLSS FG): verify DLSS FG menu stepping, Streamline restart flow, and zero regressions (`@Beanstalk` / by hand). - Linux Mesa RADV / Intel Arc / non-RDNA4 AMD: verify clean probe fallback (`FSR4_FG_SKIP_NO_LIBRARY` / `FSR4_FG_SKIP_NO_MODEL`) and builds without `--upscaler fsr4` (`@Beanstalk` / CI). ## Measurements **Verdict:** Pending — interleaved A/B frame-time and pacing measurements against `main @ cb0a2763` (FSR 4 FG 2× vs FSR 3.1 FG 2× vs FG Off in SDR and Native HDR) still to be recorded while in WIP. Setup: Windows 11, AMD Radeon RX 9070 XT, Adrenalin 26.11.2, 3840×2160 @ 120 Hz. | | Before: main @ cb0a2763 | After: this PR @ d84c9d8b | |---|---|---| | Frame rate / GPU time / pacing | TBD | TBD | ## Risks - Adds MIT-licensed AMD FidelityFX SDK v2.4.0 frame-generation headers (`third_party/fidelityfx/framegeneration/include/ffx_framegeneration*.h`); no AMD binaries ship with Longshot. - `RX_VK_FSR4_FG=0` disables FSR 4 FG completely for a run; reverting the branch restores `main` with no save, cache, or `longshot_options.ini` incompatibility (an older ini's `frame_generation_by=0` stays FSR 3.1 FG / DLSS FG). - Needs re-verification in-game on `d84c9d8b` after adapting to upstream's 10-bit Native HDR (`3f94da5d`), Streamline (`6e6f1160`, `450e63b8`), and 45 FPS cap (`53607d0d`) changes. ## Checklist ### Ready for review - [x] One topic, on current `main` (`cb0a2763`); the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. *(Ran earlier pre-rebase build on RX 9070 XT; needs quick re-run on rebased `d84c9d8b`.)* - [ ] `mise run test` passes (any failure that also fails on `main` is named). *(Targeted unit tests passed; full `mise run test` not yet run.)* - [ ] Measured against `main`, or Measurements says why there is nothing to measure. *(Interleaved measurements TBD in WIP.)* - [ ] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. *(Note: adds MIT-licensed FFX SDK 2.4.0 headers under `third_party/fidelityfx/framegeneration/include/` with `PROVENANCE.md` / `README.md` / `scripts/fetch.py` / `mise.lock` updated.)* ### When it applies - [x] A switch added or changed: `RX_VK_FSR4_FG` added with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] The SPIR-V headers regenerated (`gpu/vk/shaders/fg_hud_fsr4_pq_comp_spv.h`). - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. *(Compiled with MinGW `g++` on Windows; Linux build pending CI.)* - [ ] Screenshots of the same spot on `main` and here, for a change that shows on screen. *(Pending in-game capture on `d84c9d8b`.)* - [x] Docs updated (`docs/dev/reference/upscalers.md`, `docs/user/graphics-and-controls.md`). ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
Integrates standalone AMD FSR 4 Frame Generation (FidelityFX SDK v2.4.0,
MLFI 4.0.2) without proxy swapchain, supports Auto and Fixed 2x modes,
auto-selects FSR 4 FG and enables AMD Anti-Lag 2 when switching Frame
generation to Auto on supported GPUs, and adds unit tests and i18n.
feat(vk): add 10-bit PQ Native HDR path for AMD FSR 4 Frame Generation
Some checks failed
PR description / Title and description (pull_request_target) Successful in 14s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
946ffd684f
Allocates 10-bit A2B10G10R10_UNORM_PACK32 framegen buffers strictly for
AMD FSR 4 FG in Native HDR, adds rgb10_a2 copy/synth/HUD-composite
compute shaders, and passes the dynamic color format to FFX FG.
Author
First-time contributor

Tested in game: Windows 11, AMD Radeon RX 9070 XT, Adrenalin 26.11.2, 4K: FSR 4 FG 4.0.2 verified in 3D gameplay (SDR and Native HDR PQ)

Tested in game: Windows 11, AMD Radeon RX 9070 XT, Adrenalin 26.11.2, 4K: FSR 4 FG 4.0.2 verified in 3D gameplay (SDR and Native HDR PQ)
Member

Possibly related, for context:

  • PR #2204 WIP: fix(vk): preserve FSR HUD marking at reduced output resolution — Open FSR frame-generation HUD routing work overlaps shared vk_framegen HUD paths.
  • PR #2414 fix(vk): preserve 10-bit frame generation in Native HDR — Merged change provides the Native HDR 10-bit frame-generation format this builds on.
  • PR #2169 fix(vk): preserve Native HDR HUD colors in FSR frame generation — Merged Native HDR HUD-color handling is relevant to this new FSR-generated HUD composite.
  • PR #2706 perf(vk): cut 2880x1800 temporal and cropped-present GPU time -0.71 ms (+2.0-2.5% FPS) via 32-bit SDR targets and direct crop UVs — Merged frame-generation HUD and temporal-format changes share paths touched by this PR.
Possibly related, for context: - PR #2204 WIP: fix(vk): preserve FSR HUD marking at reduced output resolution — Open FSR frame-generation HUD routing work overlaps shared vk_framegen HUD paths. - PR #2414 fix(vk): preserve 10-bit frame generation in Native HDR — Merged change provides the Native HDR 10-bit frame-generation format this builds on. - PR #2169 fix(vk): preserve Native HDR HUD colors in FSR frame generation — Merged Native HDR HUD-color handling is relevant to this new FSR-generated HUD composite. - PR #2706 perf(vk): cut 2880x1800 temporal and cropped-present GPU time -0.71 ms (+2.0-2.5% FPS) via 32-bit SDR targets and direct crop UVs — Merged frame-generation HUD and temporal-format changes share paths touched by this PR.
nwgat force-pushed feat/fsr4-framegen from 946ffd684f
Some checks failed
PR description / Title and description (pull_request_target) Successful in 14s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to d84c9d8b1d
Some checks failed
PR description / Title and description (pull_request_target) Successful in 9s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-11-29 23:13:14 +00:00
Compare
Member

Found while playing a build with this PR (head d84c9d8b1) merged on main 28cb22b9e: with Frame generation at Auto, the FSR 4 FG context is dropped after every present and made again at the next one.

gpu/vk/vk_replay.cpp, after the frame-generation recording:

if (swapchain_framegen() < 1) fsr4_fg_idle();

swapchain_framegen() (vk_main.cpp) returns 0 for Auto as well as Off (framegen >= 2 ? ... : 0), so in Auto fsr4_fg_idle() runs every present and retires the context, and fsr4_fg_frames makes a new one on the next frame. The comment above it says the intent is "idle only at Off".

From the play log (Windows 11, RX 9070 XT, Adrenalin 26.11.2, 5120x1440): 249 FSR FG 4.0.2 made for 5120x1440 lines in one session, 209 of them one frame after the previous, median 95.7 ms of CPU each (the first 16.3 s). The game was CPU-bound with Auto on.

The fix I ran with:

// (Off only: swapchain_framegen() is 0 for Auto too)
if (framegen_now() < 1) fsr4_fg_idle();

framegen_now() is opts.framegen as it runs (1 at Auto, 0 at Off). With it, test_fsr4_fg.py, test_framegen_by_row.py, test_framegen_dlss_cap.py, test_present_held_image.py and test_rt_pin.py pass. Fixed 2x was not affected (swapchain_framegen() is 2 there). Not checked in game beyond the context being made once: a test that changes the row to Auto and counts context creations over several presents would catch it.

Found while playing a build with this PR (head d84c9d8b1) merged on main 28cb22b9e: with Frame generation at **Auto**, the FSR 4 FG context is dropped after every present and made again at the next one. `gpu/vk/vk_replay.cpp`, after the frame-generation recording: ```cpp if (swapchain_framegen() < 1) fsr4_fg_idle(); ``` `swapchain_framegen()` (vk_main.cpp) returns 0 for Auto as well as Off (`framegen >= 2 ? ... : 0`), so in Auto `fsr4_fg_idle()` runs every present and retires the context, and `fsr4_fg_frames` makes a new one on the next frame. The comment above it says the intent is "idle only at Off". From the play log (Windows 11, RX 9070 XT, Adrenalin 26.11.2, 5120x1440): 249 `FSR FG 4.0.2 made for 5120x1440` lines in one session, 209 of them one frame after the previous, median 95.7 ms of CPU each (the first 16.3 s). The game was CPU-bound with Auto on. The fix I ran with: ```cpp // (Off only: swapchain_framegen() is 0 for Auto too) if (framegen_now() < 1) fsr4_fg_idle(); ``` `framegen_now()` is `opts.framegen` as it runs (1 at Auto, 0 at Off). With it, `test_fsr4_fg.py`, `test_framegen_by_row.py`, `test_framegen_dlss_cap.py`, `test_present_held_image.py` and `test_rt_pin.py` pass. Fixed 2x was not affected (`swapchain_framegen()` is 2 there). Not checked in game beyond the context being made once: a test that changes the row to Auto and counts context creations over several presents would catch it.
nwgat force-pushed feat/fsr4-framegen from d84c9d8b1d
Some checks failed
PR description / Title and description (pull_request_target) Successful in 9s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 49bc23ee1c
Some checks failed
PR description / Title and description (pull_request_target) Successful in 5s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-01 12:10:47 +00:00
Compare
Owner

@review

Please rebase too!

@review Please rebase too!
BeanBot left a comment

Recommendation: Request changes. Auto mode repeatedly destroys and recreates the FSR 4 FG context, producing severe frame stalls. Windows players with non-ASCII installation paths can also lose access to the feature, and the claimed benefit and costs remain unmeasured.

Adds AMD FSR 4 frame generation and a Native HDR HUD composite, with an automatic FSR 4 FG default on supported hardware. It expands frame-generation choices but adds context creation, GPU work and memory use whose costs have not yet been measured.

Blocking (3): must change before merging.

  1. L1 gpu/vk/vk_replay.cpp:5741: Auto mode retires the FSR 4 FG context after every present. (more on the line) Do: Use the running frame-generation mode to distinguish Off from Auto, and add a behavioral test that checks the context stays alive across Auto presents.
  2. L2 gpu/vk/vk_fsr4_fg.cpp:198: The Windows loader passes UTF-8 paths to the ANSI file and library APIs. (more on the line) Do: Convert the UTF-8 path to UTF-16 and use GetFileAttributesW and LoadLibraryExW, as required for Windows paths.
  3. L6: It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (for the author)

Nits (1): optional.

  • L3: The summary describes behavior that the current head deliberately removed. When: It says selecting Auto sets framegen_by to 3 and enables Anti-Lag 2, but the current menu does neither; the new test explicitly forbids both assignments. Do: Update the summary and risks to describe the current default and the fact that Anti-Lag 2 is not automatically enabled.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The new default and its frame-generation benefit have no current-head measurements. When: Existing AMD users with frame generation enabled and frame_generation_by=0 automatically switch from FSR 3.1 to FSR 4 FG, but the table contains no frame-time, pacing, latency or memory results for either implementation. Do: After fixing Auto, run interleaved base and head comparisons in representative gameplay with FG off, FSR 3.1 and FSR 4 FG, in SDR and HDR; report frame times, pacing, latency and VRAM. (@fix does its part first: Preserve the existing FSR 3.1 default until the FSR 4 default is supported by measurements.)
  • L5: The changed renderer and fallback paths have not been verified on the other supported systems they affect. When: The current head changes shared input capture and frame-generation selection, including when the AMD library is unavailable; the stated NVIDIA, Linux and non-RDNA4 runs remain pending. Do: Run the stated fallback and existing frame-generation checks on Windows NVIDIA and Linux AMD/Steam Deck, plus the current head's SDR and HDR paths on supported AMD hardware.

@fix can do L1, L2, L3 and L4.

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven. The author reports successful SDR and HDR gameplay on an RX 9070 XT before the rebase, but the before-and-after measurement table is empty. A tester reported 249 context creations in Auto mode, with a median 95.7 ms CPU cost per creation, on a build containing d84c9d8b.

Other systems: The new backend changes replay recording, frame-generation input capture, HUD composition and runtime installation. NVIDIA and Intel GPUs, Linux, Steam Deck, fallback paths and the current head's SDR and HDR output still need the runs described in the pull request.

Switches: RX_VK_FSR4_FG is added: unset follows the frame-generation choice, 0 forbids FSR 4 FG, and 1 forces it. It has a switches.def row; the automatic default on supported AMD GPUs has no measurements yet.

Reviewed: 49bc23ee1c against 4908cc6dad: Read the repository rules, PR template, commit log, main renderer integration diff, FSR 4 backend, frame-generation menu changes, input changes, builder and fetch changes, and new test. Skimmed the remaining test diffs, documentation, provenance, translations and generated shader header; did not read every changed file in full. docs/review-checklist.md is absent.; nothing run (a code review).

Checked and fine:

  • The added switch has a switches.def entry.
  • The new AMD runtime is fetched through the existing licensed runtime installation path; the DLL itself is not committed.
  • The renderer API structures were not changed.

Testing: No code, tests or project scripts were run, as requested. CI is still running. The maintainer-requested rebase was not performed because the review rules expressly prohibit changing git state.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** Auto mode repeatedly destroys and recreates the FSR 4 FG context, producing severe frame stalls. Windows players with non-ASCII installation paths can also lose access to the feature, and the claimed benefit and costs remain unmeasured. Adds AMD FSR 4 frame generation and a Native HDR HUD composite, with an automatic FSR 4 FG default on supported hardware. It expands frame-generation choices but adds context creation, GPU work and memory use whose costs have not yet been measured. **Blocking (3)**: must change before merging. 1. **L1** `gpu/vk/vk_replay.cpp:5741`: Auto mode retires the FSR 4 FG context after every present. (more on the line) **Do:** Use the running frame-generation mode to distinguish Off from Auto, and add a behavioral test that checks the context stays alive across Auto presents. 2. **L2** `gpu/vk/vk_fsr4_fg.cpp:198`: The Windows loader passes UTF-8 paths to the ANSI file and library APIs. (more on the line) **Do:** Convert the UTF-8 path to UTF-16 and use GetFileAttributesW and LoadLibraryExW, as required for Windows paths. 3. **L6**: It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). *(for the author)* **Nits (1)**: optional. - **L3**: The summary describes behavior that the current head deliberately removed. *When:* It says selecting Auto sets framegen_by to 3 and enables Anti-Lag 2, but the current menu does neither; the new test explicitly forbids both assignments. **Do:** Update the summary and risks to describe the current default and the fact that Anti-Lag 2 is not automatically enabled. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The new default and its frame-generation benefit have no current-head measurements. *When:* Existing AMD users with frame generation enabled and frame_generation_by=0 automatically switch from FSR 3.1 to FSR 4 FG, but the table contains no frame-time, pacing, latency or memory results for either implementation. **Do:** After fixing Auto, run interleaved base and head comparisons in representative gameplay with FG off, FSR 3.1 and FSR 4 FG, in SDR and HDR; report frame times, pacing, latency and VRAM. *(`@fix` does its part first: Preserve the existing FSR 3.1 default until the FSR 4 default is supported by measurements.)* - **L5**: The changed renderer and fallback paths have not been verified on the other supported systems they affect. *When:* The current head changes shared input capture and frame-generation selection, including when the AMD library is unavailable; the stated NVIDIA, Linux and non-RDNA4 runs remain pending. **Do:** Run the stated fallback and existing frame-generation checks on Windows NVIDIA and Linux AMD/Steam Deck, plus the current head's SDR and HDR paths on supported AMD hardware. `@fix` can do L1, L2, L3 and L4. **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The author reports successful SDR and HDR gameplay on an RX 9070 XT before the rebase, but the before-and-after measurement table is empty. A tester reported 249 context creations in Auto mode, with a median 95.7 ms CPU cost per creation, on a build containing d84c9d8b. **Other systems:** The new backend changes replay recording, frame-generation input capture, HUD composition and runtime installation. NVIDIA and Intel GPUs, Linux, Steam Deck, fallback paths and the current head's SDR and HDR output still need the runs described in the pull request. **Switches:** RX_VK_FSR4_FG is added: unset follows the frame-generation choice, 0 forbids FSR 4 FG, and 1 forces it. It has a switches.def row; the automatic default on supported AMD GPUs has no measurements yet. **Reviewed:** 49bc23ee1c02 against 4908cc6dadff: Read the repository rules, PR template, commit log, main renderer integration diff, FSR 4 backend, frame-generation menu changes, input changes, builder and fetch changes, and new test. Skimmed the remaining test diffs, documentation, provenance, translations and generated shader header; did not read every changed file in full. docs/review-checklist.md is absent.; nothing run (a code review). **Checked and fine:** - The added switch has a switches.def entry. - The new AMD runtime is fetched through the existing licensed runtime installation path; the DLL itself is not committed. - The renderer API structures were not changed. **Testing:** No code, tests or project scripts were run, as requested. CI is still running. The maintainer-requested rebase was not performed because the review rules expressly prohibit changing git state. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +195,4 @@
if (!dev.device || !dev.physical) return l.tried = false, false;
std::string where;
for (const std::string& dir : library_dirs()) {
where += (where.empty() ? "" : ", ") + dir;
Member

L2 (blocking): The Windows loader passes UTF-8 paths to the ANSI file and library APIs.

When: When the game or RX_VK_FSR_DIR is in a path containing characters outside the Windows active code page, GetFileAttributesA or LoadLibraryExA cannot find the DLL, so FSR 4 FG is reported unavailable even when the runtime is installed.

Do: Convert the UTF-8 path to UTF-16 and use GetFileAttributesW and LoadLibraryExW, as required for Windows paths.

**L2** (blocking): The Windows loader passes UTF-8 paths to the ANSI file and library APIs. *When:* When the game or RX_VK_FSR_DIR is in a path containing characters outside the Windows active code page, GetFileAttributesA or LoadLibraryExA cannot find the DLL, so FSR 4 FG is reported unavailable even when the runtime is installed. **Do:** Convert the UTF-8 path to UTF-16 and use GetFileAttributesW and LoadLibraryExW, as required for Windows paths.
@ -5738,2 +5739,3 @@
// (frame generation at Off or Auto, where DLSS-G is not asked: its feature, if made, let go, vk_dlss.cpp)
// (frame generation at Off or Auto, where DLSS-G is not asked; FSR 4 FG runs in Auto too, so idle only at Off)
if (swapchain_framegen() < 2) dlss_fg_idle();
if (swapchain_framegen() < 1) fsr4_fg_idle();
Member

L1 (blocking): Auto mode retires the FSR 4 FG context after every present.

When: swapchain_framegen() returns 0 for both Auto and Off, so an Auto present calls fsr4_fg_idle() and the next eligible present creates a new context. The tester observed a median 95.7 ms CPU creation time and repeated stalls.

Do: Use the running frame-generation mode to distinguish Off from Auto, and add a behavioral test that checks the context stays alive across Auto presents.

**L1** (blocking): Auto mode retires the FSR 4 FG context after every present. *When:* swapchain_framegen() returns 0 for both Auto and Off, so an Auto present calls fsr4_fg_idle() and the next eligible present creates a new context. The tester observed a median 95.7 ms CPU creation time and repeated stalls. **Do:** Use the running frame-generation mode to distinguish Off from Auto, and add a behavioral test that checks the context stays alive across Auto presents.
nwgat force-pushed feat/fsr4-framegen from 49bc23ee1c
Some checks failed
PR description / Title and description (pull_request_target) Successful in 5s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 7b35d7228f
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-06 04:47:32 +00:00
Compare
fix(vk): add fg_hud_fsr4_pq_comp to shaders/recipes.toml
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
841460cc07
fix(vk): read hdr_peak_brightness from settings_now() for FSR 4 FG
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
9fe11674f8
nwgat force-pushed feat/fsr4-framegen from 9fe11674f8
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to e632dacc9f
Some checks are pending
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
2026-12-06 10:55:20 +00:00
Compare
Some checks are pending
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/fsr4-framegen:nwgat-feat/fsr4-framegen'
git switch 'nwgat-feat/fsr4-framegen'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2831
No description provided.