d3d12: leave FidelityFX maximum-size vtable patch off by default (D3D12-SERIESX-FSR-MAX-SCALED) #2756
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2756
Loading…
Reference in a new issue
No description provided.
Delete branch "pr/seriesx-dlss-black-world"
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?
Pull request successfully merged and closed
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).
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).
RUN (independent, in game): RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). Head 591bd23a7 merged with
git merge --no-ffontomaind741a9f8f and built withdiagnostics,dlss,mimalloc(DLSS SDK v310.9.16 from the repository's script, targetx86_64-pc-windows-msvc), againstmaind741a9f8f built 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,mainc4ca57615 with #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)
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).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.
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.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.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.