GPU: publish written depth planes before later draws in the same list #1018

Closed
invismann wants to merge 1 commit from upstream-pr/1018 into main
invismann commented 2026-11-28 11:14:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by invismann on 2026-11-28T11:14:12Z.


A shader can write a depth-plane twin and a later lighting draw can depth-test against the corresponding plane within the same command list. Waiting until the list closes leaves the earlier depth values visible to that draw.

Publish a written depth-plane twin after the writer is recorded. Restore the title's render-target bindings and invalidate the cached pipeline and root bindings after the copy pass. Closing the list still handles the remaining dirty twins.

Validation

  • The D3D12 regression puts the lighting draw on the same command list as the twin update and checks the resulting color. The depth and stencil twin tests pass.
  • In subsequent RTX 4090 gameplay logs, the counter for a depth texture used before its copy pass stayed at zero.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539536356 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1018). Originally posted by [invismann](https://github.com/invismann) on 2026-11-28T11:14:12Z. --- A shader can write a depth-plane twin and a later lighting draw can depth-test against the corresponding plane within the same command list. Waiting until the list closes leaves the earlier depth values visible to that draw. Publish a written depth-plane twin after the writer is recorded. Restore the title's render-target bindings and invalidate the cached pipeline and root bindings after the copy pass. Closing the list still handles the remaining dirty twins. ## Validation - The D3D12 regression puts the lighting draw on the same command list as the twin update and checks the resulting color. The depth and stencil twin tests pass. - In subsequent RTX 4090 gameplay logs, the counter for a depth texture used before its copy pass stayed at zero.
cxy0072019-sketch commented 2026-11-28 11:38:25 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cxy0072019-sketch on 2026-11-28T11:38:25Z.


Confirmed the same-list depth fix on an RTX 5070 Ti (621.24), Windows 11 build 28000, Series S profile, and 1920×1080 output. Both Gambit Bay runs used one c100068 diagnostics build, the same warmed emulator cache seed and save, and the same input sequence. A local switch selected early publication or publication at list close.

  • Early publication enabled — the “times used before the pass” counter stayed at zero in all 42 samples.
  • Publication at list close — the counter was nonzero in 31 of 38 samples and reached 2,270.
  • resource::tests::a_depth_planes_twin_is_drawn_into_the_plane passed with the early publication path. The control failed the expected lighting/readback assertion.

Both runs still had dark regions around the underwater waterline. The camera trajectories differed, so the gameplay check is limited to the depth counter and the targeted rendering test.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7238684778 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1018#issuecomment-7238684778). Originally posted by [cxy0072019-sketch](https://github.com/cxy0072019-sketch) on 2026-11-28T11:38:25Z. --- Confirmed the same-list depth fix on an RTX 5070 Ti (621.24), Windows 11 build 28000, Series S profile, and 1920×1080 output. Both Gambit Bay runs used one `c100068` diagnostics build, the same warmed emulator cache seed and save, and the same input sequence. A local switch selected early publication or publication at list close. - Early publication enabled — the “times used before the pass” counter stayed at zero in all 42 samples. - Publication at list close — the counter was nonzero in 31 of 38 samples and reached 2,270. - `resource::tests::a_depth_planes_twin_is_drawn_into_the_plane` passed with the early publication path. The control failed the expected lighting/readback assertion. Both runs still had dark regions around the underwater waterline. The camera trajectories differed, so the gameplay check is limited to the depth counter and the targeted rendering test.
Dukestar69 commented 2026-11-28 11:44:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T11:44:59Z.

Review: APPROVED


Tested locally merged onto main (63b902f).

  • Merge & Policy: Clean merge across draw.rs, host.rs, and resource.rs; cargo xtask policy passed (294 files ok).
  • Tests (RTX 5090):
    • cargo test -p victory-gpu --lib resource:: passed (20 passed; 0 failed, including a_depth_texture_and_its_twin_copy_into_each_other, a_depth_planes_twin_is_drawn_into_the_plane, and a_stencil_planes_twin_reaches_the_plane).
    • cargo test -p victory-gpu --lib draw:: passed (8 passed; 0 failed; 1 ignored).
  • Compiled with 0 warnings.

Clean intra-list depth-plane publication fix. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6097590673 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1018#pullrequestreview-6097590673). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-28T11:44:59Z. **Review:** APPROVED --- Tested locally merged onto `main` (`63b902f`). - **Merge & Policy**: Clean merge across `draw.rs`, `host.rs`, and `resource.rs`; `cargo xtask policy` passed (`294 files ok`). - **Tests (RTX 5090)**: - `cargo test -p victory-gpu --lib resource::` passed (`20 passed; 0 failed`, including `a_depth_texture_and_its_twin_copy_into_each_other`, `a_depth_planes_twin_is_drawn_into_the_plane`, and `a_stencil_planes_twin_reaches_the_plane`). - `cargo test -p victory-gpu --lib draw::` passed (`8 passed; 0 failed; 1 ignored`). - Compiled with 0 warnings. Clean intra-list depth-plane publication fix. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Yoshi-233 commented 2026-11-28 12:11:46 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoshi-233 on 2026-11-28T12:11:46Z.


I tested c100068f on an RTX 4070 Ti SUPER (16 GB, driver 617.42) on Windows. Both runs started from copies of the same save and used Series X, DLSS Quality M at 2560×1440 → 3840×2160, 2× frame generation, and the BVH builder disabled. The candidate adds this PR to the local baseline.

In the safehouse living room, the cumulative times used before the pass counter rose from 5,965 to 6,269 over 20.8 seconds on the baseline. On the candidate it stayed at zero over 20.5 seconds in the same room. The separate times not given back to a twin counter still increased in both runs. The three Windows depth/stencil twin tests also passed.

Bright white streaks on the wooden floor remain visible in the game's own backbuffer captures with either build. I would count this as a confirmed same-list ordering improvement on Ada and keep the remaining floor artifact open. The camera positions differ slightly, so I am not drawing an FPS or pixel-level quality conclusion from these runs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239059065 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1018#issuecomment-7239059065). Originally posted by [Yoshi-233](https://github.com/Yoshi-233) on 2026-11-28T12:11:46Z. --- I tested c100068f on an RTX 4070 Ti SUPER (16 GB, driver 617.42) on Windows. Both runs started from copies of the same save and used Series X, DLSS Quality M at 2560×1440 → 3840×2160, 2× frame generation, and the BVH builder disabled. The candidate adds this PR to the local baseline. In the safehouse living room, the cumulative `times used before the pass` counter rose from 5,965 to 6,269 over 20.8 seconds on the baseline. On the candidate it stayed at zero over 20.5 seconds in the same room. The separate `times not given back to a twin` counter still increased in both runs. The three Windows depth/stencil twin tests also passed. Bright white streaks on the wooden floor remain visible in the game's own backbuffer captures with either build. I would count this as a confirmed same-list ordering improvement on Ada and keep the remaining floor artifact open. The camera positions differ slightly, so I am not drawing an FPS or pixel-level quality conclusion from these runs.
trustno1-coder commented 2026-11-28 19:23:26 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:23:26Z.


Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244507915 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1018#issuecomment-7244507915). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T19:23:26Z. --- Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!1018
No description provided.