victory-gpu: WC BAR honours the write-back cutoff (VICTORY_WC_BAR=1; =2 legacy) (#355) #481

Merged
cloph-dsp merged 1 commit from upstream-pr/481 into main 2026-11-29 08:17:00 +00:00
cloph-dsp commented 2026-11-27 23:16:24 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-27T23:16:24Z.


Depends on: #355

VICTORY_WC_BAR=1 gave every write-combined title buffer a single GPU-upload (BAR) copy whose shader writes were never landed, regardless of VICTORY_WC_NO_BACK_MIN_KB. Small shader results the title reads back (exposure and similar) went stale; the issue reports ~1,450 fewer draws a frame in the cell.

Change (1 file, +36/-7, crates/victory-gpu/src/shadow.rs):

  • wc_bar(len) now takes the copy length and honours the write-back cutoff: mode 1 places only copies with len >= VICTORY_WC_NO_BACK_MIN_KB in the BAR; smaller ones keep the two-sided path and its write-back.
  • VICTORY_WC_BAR=2 keeps the original unrestricted policy for comparison.
  • The wc_no_back condition reuses a shared wc_no_back_cutoff() helper.
  • Synthetic unit test shadow::write_combined_tests::bar_obeys_write_back_policy_unless_legacy_mode_is_selected covers all mode/cutoff/length combinations.

Validation (Windows, Rust 1.100.0/MSVC, Scoop rust-msvc, cargo test --locked, worktree-local CARGO_TARGET_DIR, synthetic inputs only):

  • cargo test --locked -p victory-gpu --lib -- shadow::write_combined_tests --test-threads=1 --quiet → 2 passed, 0 failed (new test + existing write_combined_regions).
  • git grep on base df2daaf confirms the new test name is absent (negative control).
  • git diff --check clean.

Only the named tests were replayed; full workspace suite and clippy not run locally (no rustup/clippy component). GPU/driver N/A (pure policy function, CPU-only tests). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5534327564 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/481). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T23:16:24Z. --- Depends on: #355 `VICTORY_WC_BAR=1` gave every write-combined title buffer a single GPU-upload (BAR) copy whose shader writes were never landed, regardless of `VICTORY_WC_NO_BACK_MIN_KB`. Small shader results the title reads back (exposure and similar) went stale; the issue reports ~1,450 fewer draws a frame in the cell. Change (1 file, +36/-7, `crates/victory-gpu/src/shadow.rs`): - `wc_bar(len)` now takes the copy length and honours the write-back cutoff: mode `1` places only copies with `len >= VICTORY_WC_NO_BACK_MIN_KB` in the BAR; smaller ones keep the two-sided path and its write-back. - `VICTORY_WC_BAR=2` keeps the original unrestricted policy for comparison. - The `wc_no_back` condition reuses a shared `wc_no_back_cutoff()` helper. - Synthetic unit test `shadow::write_combined_tests::bar_obeys_write_back_policy_unless_legacy_mode_is_selected` covers all mode/cutoff/length combinations. Validation (Windows, Rust 1.100.0/MSVC, Scoop rust-msvc, `cargo test --locked`, worktree-local `CARGO_TARGET_DIR`, synthetic inputs only): - `cargo test --locked -p victory-gpu --lib -- shadow::write_combined_tests --test-threads=1 --quiet` → 2 passed, 0 failed (new test + existing `write_combined_regions`). - `git grep` on base `df2daaf` confirms the new test name is absent (negative control). - `git diff --check` clean. Only the named tests were replayed; full workspace suite and clippy not run locally (no rustup/clippy component). GPU/driver N/A (pure policy function, CPU-only tests). AI-assisted (Hy4 flash). No game data, assets, extracted shaders, DRM or decrypt.
MJ26gaming commented 2026-11-27 23:42:09 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by MJ26gaming on 2026-11-27T23:42:09Z.


Thanks! Checked the diff: it's identical to the patch from #355, test included. I've been running exactly this on AMD (RX 9070 XT, Proton/vkd3d-proton, Series S): picture correct, 29.94 / 29.90 fps over a 10-minute run with VICTORY_WC_NO_BACK=1 VICTORY_WC_NO_BACK_MIN_KB=1024 VICTORY_WC_BAR=1.

One note for reviewers: with VICTORY_WC_BAR=1 and VICTORY_WC_NO_BACK unset, there's no cutoff, so no BAR copies are made at all. Mode 1 now effectively needs WC_NO_BACK=1. That's intended (BAR copies never write back), but users who set WC_BAR=1 alone should use =2 for the old behaviour.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7230343162 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/481#issuecomment-7230343162). Originally posted by [MJ26gaming](https://github.com/MJ26gaming) on 2026-11-27T23:42:09Z. --- Thanks! Checked the diff: it's identical to the patch from #355, test included. I've been running exactly this on AMD (RX 9070 XT, Proton/vkd3d-proton, Series S): picture correct, 29.94 / 29.90 fps over a 10-minute run with `VICTORY_WC_NO_BACK=1 VICTORY_WC_NO_BACK_MIN_KB=1024 VICTORY_WC_BAR=1`. One note for reviewers: with `VICTORY_WC_BAR=1` and `VICTORY_WC_NO_BACK` unset, there's no cutoff, so no BAR copies are made at all. Mode 1 now effectively needs `WC_NO_BACK=1`. That's intended (BAR copies never write back), but users who set `WC_BAR=1` alone should use `=2` for the old behaviour.
KelvinSilvaDev commented 2026-11-28 15:55:24 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by KelvinSilvaDev on 2026-11-28T15:55:24Z.


Independent confirmation on Windows + NVIDIA Ampere, native D3D12 (RTX 3090 24 GB, Resizable BAR on, driver 621.40, Ryzen 7 7700), Series S profile, DLSS Performance, FSR 3 frame generation 2x, VICTORY_WC_NO_BACK=1 VICTORY_WC_NO_BACK_MIN_KB=1024 from the launcher defaults.

Same fixed save (a long boat cutscene), 6-minute release runs, frame-rate cap off, screenshots taken at the same offsets after the menu Enter:

build median ms/frame submit thread preparing waiting for the card draws/frame picture
main, WC_BAR off 40.8 28.4 ms 2.4 ms 3,982 correct
main, WC_BAR=1 36.4 18.2 ms 2.1 ms 3,886 dark (exposure), skinned hair and beards exploded into spikes, ghosted characters
this PR, WC_BAR=1 38.0 23.0 ms 5.6 ms 4,022 correct: faces, lighting and characters match the run without BAR

So on this card the PR keeps a real part of the gain (about 5 ms of the submitting thread and about 7% of the frame in a GPU-bound scene) without the stale results. One residue we saw: in some frames a thin row of dotted pixels just under the picture, in the bottom letterbox, which does not appear with WC_BAR off. Happy to test a follow-up for that.

Numbers are from the runtime's own frame-rate lines. Measured with the help of an AI assistant (Claude).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7241839752 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/481#issuecomment-7241839752). Originally posted by [KelvinSilvaDev](https://github.com/KelvinSilvaDev) on 2026-11-28T15:55:24Z. --- Independent confirmation on **Windows + NVIDIA Ampere**, native D3D12 (RTX 3090 24 GB, Resizable BAR on, driver 621.40, Ryzen 7 7700), Series S profile, DLSS Performance, FSR 3 frame generation 2x, `VICTORY_WC_NO_BACK=1 VICTORY_WC_NO_BACK_MIN_KB=1024` from the launcher defaults. Same fixed save (a long boat cutscene), 6-minute release runs, frame-rate cap off, screenshots taken at the same offsets after the menu Enter: | build | median ms/frame | submit thread preparing | waiting for the card | draws/frame | picture | |---|---|---|---|---|---| | main, `WC_BAR` off | 40.8 | 28.4 ms | 2.4 ms | 3,982 | correct | | main, `WC_BAR=1` | 36.4 | 18.2 ms | 2.1 ms | 3,886 | dark (exposure), skinned hair and beards exploded into spikes, ghosted characters | | this PR, `WC_BAR=1` | 38.0 | 23.0 ms | 5.6 ms | 4,022 | correct: faces, lighting and characters match the run without BAR | So on this card the PR keeps a real part of the gain (about 5 ms of the submitting thread and about 7% of the frame in a GPU-bound scene) without the stale results. One residue we saw: in some frames a thin row of dotted pixels just under the picture, in the bottom letterbox, which does not appear with `WC_BAR` off. Happy to test a follow-up for that. Numbers are from the runtime's own frame-rate lines. Measured with the help of an AI assistant (Claude).
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!481
No description provided.