d3d12: FSR 4 frame generation on AMD cards, LEONIDA_FSR_FRAMEGEN=4 and auto (D3D12-FSR4-FRAMEGEN) #3465

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "+refs/pull/3465/head:oreofr/fsr4-framegen"
git switch "oreofr/fsr4-framegen"
Open
leonida/mandy
OreoFR wants to merge 2 commits from oreofr/fsr4-framegen into main AGit

This pull request has changes conflicting with the target branch.

Merge manually to resolve the conflicts.

Conversation
Reviewers 0 approvals
  • No reviewers
Details

This pull request has changes conflicting with the target branch.

Merge manually to resolve the conflicts.

  • d3d12/README.md
  • d3d12/apps/leonida/src/run.rs
  • d3d12/crates/leonida-gpu/src/list.rs
  • d3d12/crates/leonida-hle/src/modules/ffx.rs
  • d3d12/docs/findings.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3465/head:oreofr/fsr4-framegen'
git switch 'oreofr/fsr4-framegen'
Member

Claim: D3D12-FSR4-FRAMEGEN (#3312)
Depends on: #3404 (built on its head aa858e69f; the first commit here is #3404's, review the last one: 55009cb48)

Port of TrustNo1/Darner 5b835457d, 1fda65f3b, b314ddb48, 9148c28c4, 642d23ff4 and a48bcd47a (trustno1-coder, GPL-3.0-or-later), rewritten for Mandy's fsr.rs (same VIctory-NVIDIA ancestor).

What

  • Provider choice in fsr::swap_chain(): with LEONIDA_FSR_FRAMEGEN=4, ffxQuery (GET_VERSIONS) lists the frame generation and swap chain providers for the device; the generator 4.0.2 and swap chain 4.0.0 are asked for with an OVERRIDE_VERSION header ahead of the version header, and after each creation GET_PROVIDER_VERSION must name the provider asked for. One that does not confirm is let go and the log names what answered instead (1fda65f3b).
  • Fallback (5b835457d): 4.0.2 is RDNA 4's. A card not offered both, a back buffer other than R8G8B8A8, or a loader without ffxQuery gets AMD's default generator and swap chain (FSR 3.1) from the same inputs, rather than no frame generation.
  • Switch: LEONIDA_FSR_FRAMEGEN=4 FSR 4, =1 FSR 3 as before, =auto FSR 4 on an AMD card (PCI vendor 0x1002) and FSR 3 elsewhere (a48bcd47a's AUTO, on the runtime side). play-nvidia.ps1 takes 4 and auto where it took 1 (DLL check, Smooth Motion off, start line). The runtime F1 menu offers OFF / FSR 3 / FSR 4 / AUTO.
  • F3: FSR FRAME GEN ON|OFF PROVIDER <version> while FidelityFX's swap chain is in use (b314ddb48); the log's 600-present count line names the generator.
  • HDR: Darner's OFF (HDR) row (9148c28c4/642d23ff4) is not needed here: another format falls back to FSR 3.1 instead of turning generation off. The HDR10 two-liner (d80420d43/838fb926f) is left to the HDR10 work (fsr4_format() is where R10G10B10A2 would go).
  • Not ported: the depth/MV snapshot (3142daea1 / 4f7aa95d3, Darner PR 139, + cb2aef45f). In Darner FSR FG made no frames at relay stage 0 because the states it tracked at the present came from its line of submissions. Here fg::inputs_for_present() reads the host copies' states, which prelude() sets at each submission with or without the relay, and #3404's FSR 4 upscaler already tags the inputs (list.rs, fg::tag_plain). This comes from reading the code, not from a run: see the RDNA 2/3 check below.
  • Docs: findings.md entry with Darner's measurements (RX 9070, FSR 4 FG 2x, RELAY=0: 105-110 presents in 10 s with a generated frame, 0 failed prepares; no fps A/B); switches.md regenerated; README row.

Tests

  • New in fsr::tests: the_switch_picks_fsr_3_fsr_4_or_by_the_card, fsr_4_providers_are_both_found_or_fsr_3_1_is_used, only_the_provider_asked_for_confirms, fsr_4_takes_the_sdr_back_buffer, query_layouts_match_the_headers. Red/green: with 4 not parsed and the fallback removed (providers always made), the first two fail; with the change, all 8 fsr::tests pass.
  • cargo test -p leonida-gpu --lib --locked: 742 passed, 0 failed. cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings: clean.
  • python -I tests/test_d3d12_switches.py, tests/test_leonida_launcher.py, tests/test_launcher_quoting.py: OK. play-nvidia.ps1 parses.
  • GPUs tested: RTX 4070 Laptop (NVIDIA), build and unit tests only. The FG path is not exercised there and no game was started.

Needs AMD hardware

  • RDNA 4 (RX 9060/9070): LEONIDA_FSR_FRAMEGEN=4. The log should say "confirmed swap chain provider 4.0.0" and "confirmed generator provider 4.0.2", F3 should show PROVIDER 4.0.2, and the 600-present line should have on > 0.
  • RDNA 2/3: =4 should fall back with "not offered both ... FSR 3.1 instead" and F3 should show a 3.1.x provider. Also check LEONIDA_RELAY=0 LEONIDA_FSR_FRAMEGEN=1 (#3403's AMD default) still generates (on > 0). If it does not, the snapshot above has to be ported.

Follow-up, not here: the launcher's frame generation choice (OreoFR's domain) can send LEONIDA_FSR_FRAMEGEN=auto / 4.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

Claim: `D3D12-FSR4-FRAMEGEN` (#3312) Depends on: #3404 (built on its head `aa858e69f`; the first commit here is #3404's, review the last one: `55009cb48`) Port of TrustNo1/Darner `5b835457d`, `1fda65f3b`, `b314ddb48`, `9148c28c4`, `642d23ff4` and `a48bcd47a` (trustno1-coder, GPL-3.0-or-later), rewritten for Mandy's `fsr.rs` (same VIctory-NVIDIA ancestor). ## What - **Provider choice** in `fsr::swap_chain()`: with `LEONIDA_FSR_FRAMEGEN=4`, `ffxQuery` (GET_VERSIONS) lists the frame generation and swap chain providers for the device; the generator `4.0.2` and swap chain `4.0.0` are asked for with an `OVERRIDE_VERSION` header ahead of the version header, and after each creation GET_PROVIDER_VERSION must name the provider asked for. One that does not confirm is let go and the log names what answered instead (1fda65f3b). - **Fallback** (5b835457d): `4.0.2` is RDNA 4's. A card not offered both, a back buffer other than R8G8B8A8, or a loader without `ffxQuery` gets AMD's default generator and swap chain (FSR 3.1) from the same inputs, rather than no frame generation. - **Switch**: `LEONIDA_FSR_FRAMEGEN=4` FSR 4, `=1` FSR 3 as before, `=auto` FSR 4 on an AMD card (PCI vendor 0x1002) and FSR 3 elsewhere (a48bcd47a's AUTO, on the runtime side). `play-nvidia.ps1` takes `4` and `auto` where it took `1` (DLL check, Smooth Motion off, start line). The runtime F1 menu offers OFF / FSR 3 / FSR 4 / AUTO. - **F3**: `FSR FRAME GEN ON|OFF PROVIDER <version>` while FidelityFX's swap chain is in use (b314ddb48); the log's 600-present count line names the generator. - **HDR**: Darner's `OFF (HDR)` row (9148c28c4/642d23ff4) is not needed here: another format falls back to FSR 3.1 instead of turning generation off. The HDR10 two-liner (d80420d43/838fb926f) is left to the HDR10 work (`fsr4_format()` is where R10G10B10A2 would go). - **Not ported: the depth/MV snapshot** (3142daea1 / 4f7aa95d3, Darner PR 139, + cb2aef45f). In Darner FSR FG made no frames at relay stage 0 because the states it tracked at the present came from its line of submissions. Here `fg::inputs_for_present()` reads the host copies' states, which `prelude()` sets at each submission with or without the relay, and #3404's FSR 4 upscaler already tags the inputs (`list.rs`, `fg::tag_plain`). This comes from reading the code, not from a run: see the RDNA 2/3 check below. - Docs: `findings.md` entry with Darner's measurements (RX 9070, FSR 4 FG 2x, `RELAY=0`: 105-110 presents in 10 s with a generated frame, 0 failed prepares; no fps A/B); `switches.md` regenerated; README row. ## Tests - New in `fsr::tests`: `the_switch_picks_fsr_3_fsr_4_or_by_the_card`, `fsr_4_providers_are_both_found_or_fsr_3_1_is_used`, `only_the_provider_asked_for_confirms`, `fsr_4_takes_the_sdr_back_buffer`, `query_layouts_match_the_headers`. Red/green: with `4` not parsed and the fallback removed (providers always made), the first two fail; with the change, all 8 `fsr::tests` pass. - `cargo test -p leonida-gpu --lib --locked`: 742 passed, 0 failed. `cargo clippy -p leonida-gpu --all-targets --locked -- -D warnings`: clean. - `python -I tests/test_d3d12_switches.py`, `tests/test_leonida_launcher.py`, `tests/test_launcher_quoting.py`: OK. `play-nvidia.ps1` parses. - GPUs tested: RTX 4070 Laptop (NVIDIA), build and unit tests only. The FG path is not exercised there and no game was started. ## Needs AMD hardware - **RDNA 4** (RX 9060/9070): `LEONIDA_FSR_FRAMEGEN=4`. The log should say "confirmed swap chain provider 4.0.0" and "confirmed generator provider 4.0.2", F3 should show `PROVIDER 4.0.2`, and the 600-present line should have `on` > 0. - **RDNA 2/3**: `=4` should fall back with "not offered both ... FSR 3.1 instead" and F3 should show a 3.1.x provider. Also check `LEONIDA_RELAY=0 LEONIDA_FSR_FRAMEGEN=1` (#3403's AMD default) still generates (`on` > 0). If it does not, the snapshot above has to be ported. Follow-up, not here: the launcher's frame generation choice (OreoFR's domain) can send `LEONIDA_FSR_FRAMEGEN=auto` / `4`. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LEONIDA_UPSCALE=fsr4 (off by default) records AMD's signed
amd_fidelityfx_upscaler_dx12.dll (FidelityFX SDK v2.4.0) for the title's
upscale, where DLSS is recorded, on AMD adapters only (vendor 0x1002; on
any other the DLL is not loaded). The newest FSR 4.x provider the DLL
offers is picked, else FSR 3.1.x. A missing DLL, bad signature, missing
provider or refused context logs one line and leaves the stretch.

scripts/get-amd-fidelityfx.ps1 -Upscaler fetches the DLL from AMD's
GitHub at v2.4.0, pinned by size, git blob, SHA-256 and AMD's signature.

After Darner (TrustNo1/Darner, GPL-3.0-or-later) commit 5345be7 by ggwp,
itself adapted from Marvisak/VIctory PR #2751.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LEONIDA_FSR_FRAMEGEN=4 asks AMD's loader (ffxQuery) for the frame generation
provider 4.0.2 and the frame interpolation swap chain 4.0.0, makes both with
an override description and confirms each with the provider behind the new
context; one that does not confirm is let go and named in the log. A card not
offered both (4.0.2 is RDNA 4's), another back buffer format or a loader
without ffxQuery get AMD's default generator and swap chain (FSR 3.1) instead
of no frame generation. `auto` is FSR 4 on an AMD card and FSR 3 elsewhere;
`1` stays FSR 3. The F3 panel shows the provider version in use, the F1 menu
offers FSR 3 / FSR 4 / AUTO, and play-nvidia.ps1 takes 4 and auto as it takes 1.

The depth/motion snapshot of Darner 4f7aa95d3 is not ported: here the FG
inputs' states are set at each submission with or without the relay
(findings.md says why; to confirm on an AMD card).

Item: D3D12-FSR4-FRAMEGEN
Depends on: #3404
Port of TrustNo1/Darner 5b835457d, 1fda65f3b, b314ddb48, 9148c28c4,
642d23ff4 and a48bcd47a (trustno1-coder), GPL-3.0-or-later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OreoFR referenced this pull request from a commit 2026-12-04 14:36:14 +00:00
Sign in to join this conversation.
No description provided.