d3d12: honor FidelityFX mv_jittered flag in DLSS and Frame Generation #3378

Merged
leonida/mandy
Doffi4 merged 2 commits from github-pr/3378 into main 2026-12-04 03:20:00 +00:00

Pull request successfully merged and closed

Doffi4 commented 2026-12-03 18:01:18 +00:00

Claimed in the coordination issue as: D3D12-DLSS-MV-JITTERED (https://github.com/ProjectLeonida/mandy/issues/3312#issuecomment-7387426972)

What and why

dlss::record hardcoded FLAG_MV_JITTERED in DLSS.Feature.Create.Flags and fg::constants hardcoded motionVectorsJittered = sl::Boolean::eTrue, ignoring whether the title actually created its FidelityFX upscaler with FFX_UPSCALE_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION (bit 2, 0x04).

When the title supplies unjittered motion vectors (bit 2 unset in the FidelityFX creation flags), telling NGX DLSS and Streamline Frame Generation that the motion vectors are jittered causes them to subtract camera jitter a second time, producing a persistent high-frequency micro-shake on stationary scenes.

This PR propagates the FidelityFX jitter-cancellation flag end-to-end:

  • d3d12/crates/leonida-hle/src/modules/ffx.rs: reads bit 2 (FLAG_MV_JITTER_CANCELLATION) from the FidelityFX upscale creation flags (including after sizes_to_stand_in re-read) and passes mv_jittered to leonida_gpu::list::upscale.
  • d3d12/crates/leonida-gpu/src/list.rs: packs mv_jittered into bit 2 of Upscale wire word w[10] for thin-list replay and passes it to dlss::Inputs.
  • d3d12/crates/leonida-gpu/src/dlss.rs: extracts feature_flags() to set FLAG_MV_JITTERED only when mv_jittered is true (with LEONIDA_DLSS_MV_JITTERED=0|1 override), logs mv_jittered on feature creation, and forwards the effective flag to fg::tag.
  • d3d12/crates/leonida-gpu/src/fg.rs: stores mv_jittered in Latest and sets sl::Constants::motionVectorsJittered accordingly (eTrue / eFalse).
  • d3d12/docs/switches.md: regenerated via python -I tools/d3d12_switches.py --out d3d12/docs/switches.md to catalog LEONIDA_DLSS_MV_JITTERED.

Tested

  • python -I scripts/check_no_game_data.py on all 5 changed files: exit 0.
  • python -I tests/test_d3d12_switches.py: 21/21 OK.
  • cargo check -p leonida-gpu --locked (without dlss / diagnostics): pass.
  • cargo test -p leonida-hle --locked -- ffx::: 6 passed, 0 failed (includes new creation_flags_record_whether_motion_vectors_are_jittered).
  • cargo test -p leonida-gpu --features "dlss diagnostics" --lib --locked -- dlss::tests::feature_flags_honor_mv_jittered fg:: an_upscale_keeps: 23 passed, 0 failed (includes new dlss::tests::feature_flags_honor_mv_jittered and fg::defer_enable_tests::constants_follow_mv_jittered, which fails on main where motionVectorsJittered was hardcoded eTrue).
  • In-game verification: stationary-scene camera micro-shake under DLSS + Frame Generation is eliminated when FidelityFX bit 2 is unset (mv_jittered=false).
  • Audited by a separate read-only reviewer agent (PASS).

GPUs tested: NVIDIA GeForce RTX 5060 Laptop GPU (8 GB), driver 621.40, Windows 11 (26200).

AI-assisted: yes (Gemini Neon — coding agent + separate read-only reviewer agent).

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (N/A — D3D12 runtime only)
Claimed in the coordination issue as: D3D12-DLSS-MV-JITTERED (https://github.com/ProjectLeonida/mandy/issues/3312#issuecomment-7387426972) ### What and why `dlss::record` hardcoded `FLAG_MV_JITTERED` in `DLSS.Feature.Create.Flags` and `fg::constants` hardcoded `motionVectorsJittered = sl::Boolean::eTrue`, ignoring whether the title actually created its FidelityFX upscaler with `FFX_UPSCALE_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION` (bit 2, `0x04`). When the title supplies unjittered motion vectors (bit 2 unset in the FidelityFX creation flags), telling NGX DLSS and Streamline Frame Generation that the motion vectors are jittered causes them to subtract camera jitter a second time, producing a persistent high-frequency micro-shake on stationary scenes. This PR propagates the FidelityFX jitter-cancellation flag end-to-end: - `d3d12/crates/leonida-hle/src/modules/ffx.rs`: reads bit 2 (`FLAG_MV_JITTER_CANCELLATION`) from the FidelityFX upscale creation flags (including after `sizes_to_stand_in` re-read) and passes `mv_jittered` to `leonida_gpu::list::upscale`. - `d3d12/crates/leonida-gpu/src/list.rs`: packs `mv_jittered` into bit 2 of `Upscale` wire word `w[10]` for thin-list replay and passes it to `dlss::Inputs`. - `d3d12/crates/leonida-gpu/src/dlss.rs`: extracts `feature_flags()` to set `FLAG_MV_JITTERED` only when `mv_jittered` is true (with `LEONIDA_DLSS_MV_JITTERED=0|1` override), logs `mv_jittered` on feature creation, and forwards the effective flag to `fg::tag`. - `d3d12/crates/leonida-gpu/src/fg.rs`: stores `mv_jittered` in `Latest` and sets `sl::Constants::motionVectorsJittered` accordingly (`eTrue` / `eFalse`). - `d3d12/docs/switches.md`: regenerated via `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md` to catalog `LEONIDA_DLSS_MV_JITTERED`. ### Tested - `python -I scripts/check_no_game_data.py` on all 5 changed files: exit 0. - `python -I tests/test_d3d12_switches.py`: 21/21 OK. - `cargo check -p leonida-gpu --locked` (without `dlss` / `diagnostics`): pass. - `cargo test -p leonida-hle --locked -- ffx::`: 6 passed, 0 failed (includes new `creation_flags_record_whether_motion_vectors_are_jittered`). - `cargo test -p leonida-gpu --features "dlss diagnostics" --lib --locked -- dlss::tests::feature_flags_honor_mv_jittered fg:: an_upscale_keeps`: 23 passed, 0 failed (includes new `dlss::tests::feature_flags_honor_mv_jittered` and `fg::defer_enable_tests::constants_follow_mv_jittered`, which fails on `main` where `motionVectorsJittered` was hardcoded `eTrue`). - In-game verification: stationary-scene camera micro-shake under DLSS + Frame Generation is eliminated when FidelityFX bit 2 is unset (`mv_jittered=false`). - Audited by a separate read-only reviewer agent (`PASS`). GPUs tested: NVIDIA GeForce RTX 5060 Laptop GPU (8 GB), driver 621.40, Windows 11 (26200). AI-assisted: yes (Gemini Neon — coding agent + separate read-only reviewer agent). ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (N/A — D3D12 runtime only)
OreoFR referenced this pull request from a commit 2026-12-04 01:11:23 +00:00
Collaborator

Gate runs on an RTX 3090 (NVIDIA 621.40, Windows 11 Pro build 26300), executable of this pull request's head d72ecd346 (diag profile, diagnostics,dlss,mimalloc, msvc target), Series X output 2560x1440, DLSS quality, 300 s standing at the save. main reference: 6ced7a6c5 built the same way, four runs tonight.

DLSS, no frame generation

  • The feature is made with mv_jittered=false; LEONIDA_DLSS_MV_JITTERED was not set.
  • 0 device lost, 0 crash, 0 ERROR lines.
  • Frames/s over 150-300 s: 33.1, against 33.4 and 33.0 for main (means of the two pairs of reference runs, the nearest under the same PC load). No loss.

DLSS with frame generation 2x (-FrameGen 2; DLSS-G on this 30-series card through the MFG Unlocker)

  • DLSS-G active from 71 s to the end, every status line 0, 2 of 2 frames presented per rendered frame; 27.9 generated frames a second.
  • The frame-generation constants and the DLSS feature both carry mv_jittered=false, and the jitter the title sends is zero there.
  • 0 device lost, 0 crash, 0 ERROR lines; 26.5 rendered frames/s over 150-300 s.

The picture: not checked by eye on this head (it needs someone at the screen). On 2026-12-03, on the same card, a local build that only told DLSS the vectors carry no jitter (the value this change derives from the title's flags) removed the whole-image wobble for the owner's eye, against the wobble with the flag set; hair still ghosts a little in motion in both.

Verdict: PASS.

GPUs tested: NVIDIA GeForce RTX 3090, driver 621.40.
AI-assisted: runs and report by Claude Code (Claude Opus 5.5).

Gate runs on an RTX 3090 (NVIDIA 621.40, Windows 11 Pro build 26300), executable of this pull request's head `d72ecd346` (diag profile, `diagnostics,dlss,mimalloc`, msvc target), Series X output 2560x1440, DLSS quality, 300 s standing at the save. `main` reference: `6ced7a6c5` built the same way, four runs tonight. **DLSS, no frame generation** - The feature is made with `mv_jittered=false`; `LEONIDA_DLSS_MV_JITTERED` was not set. - 0 device lost, 0 crash, 0 ERROR lines. - Frames/s over 150-300 s: 33.1, against 33.4 and 33.0 for `main` (means of the two pairs of reference runs, the nearest under the same PC load). No loss. **DLSS with frame generation 2x** (`-FrameGen 2`; DLSS-G on this 30-series card through the MFG Unlocker) - DLSS-G active from 71 s to the end, every status line 0, 2 of 2 frames presented per rendered frame; 27.9 generated frames a second. - The frame-generation constants and the DLSS feature both carry `mv_jittered=false`, and the jitter the title sends is zero there. - 0 device lost, 0 crash, 0 ERROR lines; 26.5 rendered frames/s over 150-300 s. **The picture**: not checked by eye on this head (it needs someone at the screen). On 2026-12-03, on the same card, a local build that only told DLSS the vectors carry no jitter (the value this change derives from the title's flags) removed the whole-image wobble for the owner's eye, against the wobble with the flag set; hair still ghosts a little in motion in both. Verdict: PASS. GPUs tested: NVIDIA GeForce RTX 3090, driver 621.40. AI-assisted: runs and report by Claude Code (Claude Opus 5.5).
OreoFR merged commit 22182e2f6b into main 2026-12-04 03:20:00 +00:00
Member

Merging. Head 7698611e5 (d72ecd346 + main 4d9e4d05d merged in; its tree dd9b638a2 is the exact tree the CI below checked), main 4d9e4d05d → 22182e2f6.

Local CI run by the merger on d72ecd346 merged into main 4d9e4d05d (normal mode, Rust scope leonida / leonida-gpu / leonida-hle): PASS, no failure.

Step Result
Merge into main clean
No game data tracked PASS (3831 files)
No game data under another name PASS
Compile Python PASS
make_game.py --help PASS
Rust tests PASS (140 s)
Rust replay test PASS
Clippy -D warnings PASS
Python tests (standard library) PASS (454 s)
Python tests (pytest) SKIP (pytest not installed)
Sensitive files unchanged PASS

In game: enlight3d's RTX 3090 runs on d72ecd346 (DLSS quality: 33.1 fps vs main 33.0-33.4, mv_jittered=false, 0 device lost / crash / ERROR; FG 2x: DLSS-G active the whole run, 0/0/0). The shake itself was confirmed gone by eye with the same flag forced locally (Thib, RTX 3090). In the beta branch since 2026-12-04.

Approved by OreoFR (maintainer). AI-assisted (Claude Code).

Merging. Head 7698611e5 (d72ecd346 + main 4d9e4d05d merged in; its tree dd9b638a2 is the exact tree the CI below checked), main 4d9e4d05d → 22182e2f6. Local CI run by the merger on d72ecd346 merged into main 4d9e4d05d (normal mode, Rust scope leonida / leonida-gpu / leonida-hle): PASS, no failure. | Step | Result | |---|---| | Merge into main | clean | | No game data tracked | PASS (3831 files) | | No game data under another name | PASS | | Compile Python | PASS | | make_game.py --help | PASS | | Rust tests | PASS (140 s) | | Rust replay test | PASS | | Clippy -D warnings | PASS | | Python tests (standard library) | PASS (454 s) | | Python tests (pytest) | SKIP (pytest not installed) | | Sensitive files unchanged | PASS | In game: enlight3d's RTX 3090 runs on d72ecd346 (DLSS quality: 33.1 fps vs main 33.0-33.4, `mv_jittered=false`, 0 device lost / crash / ERROR; FG 2x: DLSS-G active the whole run, 0/0/0). The shake itself was confirmed gone by eye with the same flag forced locally (Thib, RTX 3090). In the beta branch since 2026-12-04. Approved by OreoFR (maintainer). AI-assisted (Claude Code).
Sign in to join this conversation.
No description provided.