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

Manually merged
github merged 1 commit from github-bot/gh-481 into main 2026-11-29 08:21:28 +00:00 AGit
Owner

@⁠cloph-dsp on GitHub · 2026-11-27 23:16 UTC · original
cloph-dsp:fix/wc-bar-writeback-cutoff → main · +36 −7 · 1 files · 1 commits · merged 2026-11-29 08:17 UTC

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.

**@⁠cloph-dsp** on GitHub · 2026-11-27 23:16 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/481) `cloph-dsp:fix/wc-bar-writeback-cutoff` → `main` · +36 −7 · 1 files · 1 commits · merged 2026-11-29 08:17 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 23:17:44 +00:00
Author
Owner

@⁠MJ26gaming on GitHub · 2026-11-27 23:42 UTC · original

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.

**@⁠MJ26gaming** on GitHub · 2026-11-27 23:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/481#issuecomment-7230343162) 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.
Author
Owner

@⁠KelvinSilvaDev on GitHub · 2026-11-28 15:55 UTC · original

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).

**@⁠KelvinSilvaDev** on GitHub · 2026-11-28 15:55 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/481#issuecomment-7241839752) 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).
github manually merged commit 55750ca669 into main 2026-11-29 08:21:28 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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