fix(gpu): raw buffer views stay inside their buffer (VICTORY_RAW_VIEW_CLAMP) #24

Merged
CuteBooty merged 1 commit from upstream-pr/24 into main 2026-11-27 09:32:01 +00:00
CuteBooty commented 2026-11-27 08:51:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CuteBooty on 2026-11-27T08:51:17Z.


raw_at / raw_uav_at bound the element count without checking what is left of the buffer. With this, a raw SRV / UAV range past the buffer's end is shortened to the whole dwords that fit, and an unaligned start, or one with no whole dword left, becomes a null view. The meter line counts the cuts. On by default; VICTORY_RAW_VIEW_CLAMP=0 gives the old descriptors exactly.

Original author: lichenlang89 (fxceless/victory-fork PR 1266). Ported by hand, same code and tests.

Honest note: in my runs the four counters stayed at zero, so the clamp never had to act here; it is covered by its unit tests only.

cargo test -p victory-gpu on this branch: 413 passed / 2 failed / 35 ignored (the two indirect::tests named below, which fail without this change too).

Tested

RTX 3070 8 GB (driver 621.24), Ryzen 5 3600, 32 GB, Windows 11; Series S profile, 1920x1080, your launcher's settings without DLSS, built from source.

  • In the game (all four of my pull requests together, on 1010e023): five runs, 73 minutes in all, 0 logged errors, no device loss. Frame times were not slower than the unmodified tree on the same save: medians of the 5-second lines in a 37-minute run were 64 / 78 / 94 ms at 3,000-5,000 / 5,000-7,000 / 7,000-9,000 draws, against 89 / 104 / 116 ms for the unmodified tree in a 51-minute run the same evening. The routes differed, so read that as "not slower", not as a gain.
  • On c437b059 (this branch is based there; it merges cleanly onto 18a8dc26): the branch compiles (cargo check --locked -p victory --features diagnostics). cargo test --workspace --locked with all four changes: 1043 passed / 3 failed / 46 ignored; on c437b059 alone: 1034 / 3 / 46. The same three fail on both: indirect::tests::host_list_budget_starts_empty_at_each_submission, indirect::tests::warp_batch_charges_every_execution, and policy::tests::repository_passes_policy (it rejects PLAY_FRAMEGEN.bat).
  • Clippy (--workspace --all-targets -- -D warnings, with and without --all-features, --keep-going): fails on c437b059 alone and with these changes, with the same findings (31 and 30 distinct, none in the changed code); the first is victory-formats/src/texture.rs:1346.

Not tested: AMD and Intel cards, DLSS and frame generation, Series X beyond one 9-minute run.

AI-assisted: ported, checked and written up with Claude Code; the game runs were played by me.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5523832386 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/24). Originally posted by [CuteBooty](https://github.com/CuteBooty) on 2026-11-27T08:51:17Z. --- `raw_at` / `raw_uav_at` bound the element count without checking what is left of the buffer. With this, a raw SRV / UAV range past the buffer's end is shortened to the whole dwords that fit, and an unaligned start, or one with no whole dword left, becomes a null view. The meter line counts the cuts. On by default; `VICTORY_RAW_VIEW_CLAMP=0` gives the old descriptors exactly. Original author: lichenlang89 (fxceless/victory-fork PR 1266). Ported by hand, same code and tests. Honest note: in my runs the four counters stayed at zero, so the clamp never had to act here; it is covered by its unit tests only. `cargo test -p victory-gpu` on this branch: 413 passed / 2 failed / 35 ignored (the two `indirect::tests` named below, which fail without this change too). ## Tested RTX 3070 8 GB (driver 621.24), Ryzen 5 3600, 32 GB, Windows 11; Series S profile, 1920x1080, your launcher's settings without DLSS, built from source. - **In the game** (all four of my pull requests together, on 1010e023): five runs, 73 minutes in all, 0 logged errors, no device loss. Frame times were not slower than the unmodified tree on the same save: medians of the 5-second lines in a 37-minute run were 64 / 78 / 94 ms at 3,000-5,000 / 5,000-7,000 / 7,000-9,000 draws, against 89 / 104 / 116 ms for the unmodified tree in a 51-minute run the same evening. The routes differed, so read that as "not slower", not as a gain. - **On c437b059** (this branch is based there; it merges cleanly onto 18a8dc26): the branch compiles (`cargo check --locked -p victory --features diagnostics`). `cargo test --workspace --locked` with all four changes: 1043 passed / 3 failed / 46 ignored; on c437b059 alone: 1034 / 3 / 46. The same three fail on both: `indirect::tests::host_list_budget_starts_empty_at_each_submission`, `indirect::tests::warp_batch_charges_every_execution`, and `policy::tests::repository_passes_policy` (it rejects `PLAY_FRAMEGEN.bat`). - **Clippy** (`--workspace --all-targets -- -D warnings`, with and without `--all-features`, `--keep-going`): fails on c437b059 alone and with these changes, with the same findings (31 and 30 distinct, none in the changed code); the first is `victory-formats/src/texture.rs:1346`. Not tested: AMD and Intel cards, DLSS and frame generation, Series X beyond one 9-minute run. AI-assisted: ported, checked and written up with Claude Code; the game runs were played by me. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!24
No description provided.