d3d12: leave FidelityFX maximum-size vtable patch off by default (D3D12-SERIESX-FSR-MAX-SCALED) #2756
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2756"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by IgorAntunes66 on 2026-11-30T15:48:54Z.
Claimed in the coordination issue as: D3D12-SERIESX-FSR-MAX-SCALED (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7283322639)
What and why
Fixes the black-world bug on Series X when upscaling through FidelityFX (LEONIDA_FSR_UPSCALER=1, DLSS or stretch) below render scale 1.0 (follow-up to ae217ceb in d3d12/docs/findings.md).
ender_scale_patches in d3d12/crates/leonida-loader/src/hooks.rs was unconditionally patching the FidelityFX upscaler's maximum-size vtable slot (x6300ba8, slot 11 -> slot 10's scaled-size function). When LEONIDA_RENDER_SCALE was below 1.0 on Series X, the title rendered the scene internally at the scaled size, ran fxDispatch to the output target, and then presented only the HUD over a completely black world.
This change leaves "render scale: FSR maximum = scaled size" off by default (kept opt-in via LEONIDA_FSR_MAX_SCALED=1 for diagnosis via parse_fsr_max_scaled), while preserving FSR_LOAD_S, FSR_LOAD_OTHER, and the title's own upscaler patches.
Follow-up kept out of this PR: removing the experimental warning and preserving the F1 menu's DLSS selection on Series X in d3d12/scripts/play-nvidia.ps1 can be proposed separately once verified across other output sizes (such as 3840x2160) and GPUs.
Tested
GPUs tested: NVIDIA GeForce RTX 5070 12 GB (desktop, profile M), driver 621.40, Windows 11.
AI-assisted: yes (implementation: Gemini 4 Neon via Antigravity; independent separate reviewer agent: Gemini 4 Neon via Antigravity — approved).
Checklist
eeds rebase).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T16:30:36Z.
Independent check on Windows (not the author), at
591bd23a7.cargo test --locked -p leonida-loader --lib(shared warm target): 82 passed, 0 failed in 0.24 s.hooks.rsonly; no game run, so this covers compile + the loader crate's unit tests. The default-off behaviour of the FidelityFX maximum-size vtable patch is not exercised by the tests.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned.
AI-assisted: yes (opencode).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T05:29:11Z.
Review: COMMENTED
The flip itself is sound and the default is pinned: making it default-on fails exactly one test (
hooks::tests::the_fidelityfx_maximum_patch_is_left_out_by_default,hooks.rs:625), the loader only writes that slot and the original function runs when off, and nothing else depends on0x6300ba8.cargo test --locked -p leonida-loaderis 82 + 2 + 1 passed, 0 failed here.Two things must change before merge:
python -I tools/d3d12_switches.py --check d3d12/docs/switches.mdis exit 0 onorigin/main86c30fceaand exit 1 on this head withmissing from the page: LEONIDA_FSR_MAX_SCALED(the other six names are pre-existing base drift, gone after a rebase). Add a row: default off, only=1turns it on (unlikeLEONIDA_OWN_UPSCALER, which is presence-on), and when it applies (LEONIDA_RENDER_SCALEset and the own upscaler not forced).LEONIDA_RENDER_SCALEis set, so Series S' native FSR now loses the patch too, while the body measures one desktop GPU under the Series X profile (and "on Series X" there is a profile, not console hardware). Say what Series S does now, or measure it — the patch was introduced for that FSR path (193152d00).Minor: only the parser is tested (
None/"0"/"1"plus the flag intorender_scale_patches); nothing drives the real env path inresolution_levers, and empty/other strings are untested, so the "unset means off" claim rests on a direct call rather than on the loader's own entry point.Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T04:08:47Z.
RUN (independent, in game): RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). Head
591bd23a7merged withgit merge --no-ffontomaind741a9f8fand built withdiagnostics,dlss,mimalloc(DLSS SDK v310.9.16 from the repository's script, targetx86_64-pc-windows-msvc), againstmaind741a9f8fbuilt the same way.Red and green, off the game. The pull request's test does not compile on
main(it calls the new API). The same assertion written withmain's API fails there for the stated reason (default patches include the FSR maximum slot) and passes on the merge.cargo test -p leonida-loaderon the merge: 86 of 86 pass. Two things not caused by this change:tests/load_probe.rs::loads_binds_and_calls_probefails the same way onmainhere (the probe DLL is built with this machine's default GNU toolchain), andconsole_insn::tests::a_clzero_loop_becomes_plain_storesis flaky onmaintoo.In game. Series X profile,
-Dlss <mode> -NoFrameGen, output 2560x1440 (LEONIDA_OUTPUT), standing at the save, the same warm data folder, a warm-up run per build first, then 600 s measured with nothing else running; captures at 120 and 300 s kept locally.mainmainlogged none either, although its world was dark).-Resolution 1440measured 42.3 to 47.0 ms median on this card (a different build,mainc4ca57615with #3000).Verdict: PASS. On this card, with DLSS on the Series X profile, the change turns the dark world into a lit one, for 0.7 ms more than the dark frame.
AI-assisted: Claude Code (Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T04:56:00Z.
Addendum to my RUN above, the output size it had not covered yet: the same merge, Series X,
-Dlss quality -NoFrameGenwith a 3840x2160 output (DLSS 2560x1440 to 3840x2160), the same warm data folder, 600 s measured. The world is lit at 120 s (cut scene) and 300 s (in play); frame median 44.1 ms, p90 49.0 ms, card busy 44.6 ms a frame; card memory at most 17.0 GB; no device loss, no "black frame" warning. So on this card the change holds at both output sizes and both modes tried (quality and balanced at 2560x1440, quality at 3840x2160).Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T04:57:03Z.
Verified by OreoFR (RUN, AI-assisted: oreofr-agent): head
591bd23a71b6df6ed8b7f50fe073fef628e869d7merged into current main8422def759cda12c89f918438eeb8d53dd5972a6(clean merge).Red / green in game: RTX 4070 Laptop 8 GB, driver 621.40, Windows 11. Series X, DLSS quality, no frame generation, same data and pipelines for both runs.
Tests:
cargo test -p leonida-loaderon the merged tree: 93 passed, 0 failed.This agrees with enlighted's 3090 result above: same fix on two cards.
Safe to merge into main?
d3d12/crates/leonida-loader/src/hooks.rs.Ready once a maintainer approves the CI runs and they are green.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T05:13:11Z.
Merging (oreofr-agent, with OreoFR's written OK as maintainer): head
591bd23a71b6df6ed8b7f50fe073fef628e869d7merged into current main8422def759cda12c89f918438eeb8d53dd5972a6with no conflicts. CI green on the head. Checked in game on the RTX 4070 Laptop (comment above) and on enlighted's 3090: the world is lit in Series X with DLSS. Going into the merge queue with #2986.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T05:31:41Z.
The merge queue took this out: on the merge with main,
tests/test_d3d12_switches.pyfails withd3d12/docs/switches.md is out of date ... missing from the page: LEONIDA_FSR_MAX_SCALED. The page lists everyLEONIDA_*name in the code, and this PR adds one.Fix: merge
main, then runpython -I tools/d3d12_switches.py --out d3d12/docs/switches.mdand commit the page (3 lines added, 2 removed). With that,python -I tests/test_d3d12_switches.pypasses here (20/20). Once it is pushed, the PR goes back into the queue.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T05:52:33Z.
Merging again (oreofr-agent, with OreoFR's written OK): head
5b005f8bb9bae6588e867d511ff395250b0d1595= the verified591bd23a7+ main8422def75merged in +d3d12/docs/switches.mdregenerated (the page the queue's tests found out of date). No code change since the in-game check. CI green on this head; back into the merge queue.