GPU: allow VICTORY_INDIRECT_GATHER=1 to work standalone without VICTORY_INDIRECT_WINDOW=1 #1068

Open
Claudinhomerq wants to merge 1 commit from upstream-pr/1070 into main
Claudinhomerq commented 2026-11-25 18:25:26 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Claudinhomerq on 2026-11-25T18:25:26Z.


Summary

Allow VICTORY_INDIRECT_GATHER=1 (and alt) to batch single indirect draw records into the list's prelude even when VICTORY_INDIRECT_WINDOW=0.

Motivation

Right now draw.rs ties list.gather_close() and let gathered = ... directly to windowed (which includes windows()):

  • When VICTORY_INDIRECT_WINDOW=0, every draw immediately closes gathering on the list and gathers() can never run.
  • Because VICTORY_INDIRECT_WINDOW=1 clamps ahead across consecutive argument slots, some titles/scenes (e.g., GTA VI interior cells) prefer keeping VICTORY_INDIRECT_WINDOW=0 while still benefitting from batching individual indirect draws in a single prelude compute pass (VICTORY_INDIRECT_GATHER=1).

What changed

  • Separated per-command eligibility (eligible: non-dispatch, max == 1, no count buffer, no buffer-storing shaders) from windowed = windows() && eligible in crates/victory-gpu/src/draw.rs (+5/-5 lines).
  • Gated list.gather_close() on !eligible and gathered on hit.is_none() && eligible && gathers().
  • Behavior when VICTORY_INDIRECT_WINDOW=1 is unchanged: window hits still take precedence and any ineligible command closes gathering identically.

Validation

  • cargo test -p victory-gpu --lib -- gathered_records warp_gathered_records --test-threads=1 (2/2 passed on WARP)
  • cargo check -p victory-gpu and cargo check -p victory-gpu --features diagnostics (0 errors)
  • cargo xtask policy (asset policy: 181 files ok)
  • Live GTA VI 4K run on RTX 5070 Ti with VICTORY_INDIRECT_WINDOW=0 + VICTORY_INDIRECT_GATHER=1: gathered up to 953 single indirect draws/frame in prelude (no_fit 0, too_many_bufs 0, set_full 0, no_buf 0), 0 crashes/TDR, 0 missing walls/geometry.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6610989075 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1070). Originally posted by [Claudinhomerq](https://github.com/Claudinhomerq) on 2026-11-25T18:25:26Z. --- ### Summary Allow `VICTORY_INDIRECT_GATHER=1` (and `alt`) to batch single indirect draw records into the list's prelude even when `VICTORY_INDIRECT_WINDOW=0`. ### Motivation Right now `draw.rs` ties `list.gather_close()` and `let gathered = ...` directly to `windowed` (which includes `windows()`): - When `VICTORY_INDIRECT_WINDOW=0`, every draw immediately closes gathering on the list and `gathers()` can never run. - Because `VICTORY_INDIRECT_WINDOW=1` clamps ahead across consecutive argument slots, some titles/scenes (e.g., GTA VI interior cells) prefer keeping `VICTORY_INDIRECT_WINDOW=0` while still benefitting from batching individual indirect draws in a single prelude compute pass (`VICTORY_INDIRECT_GATHER=1`). ### What changed - Separated per-command eligibility (`eligible`: non-dispatch, `max == 1`, no count buffer, no buffer-storing shaders) from `windowed = windows() && eligible` in `crates/victory-gpu/src/draw.rs` (+5/-5 lines). - Gated `list.gather_close()` on `!eligible` and `gathered` on `hit.is_none() && eligible && gathers()`. - Behavior when `VICTORY_INDIRECT_WINDOW=1` is unchanged: window hits still take precedence and any ineligible command closes gathering identically. ### Validation - `cargo test -p victory-gpu --lib -- gathered_records warp_gathered_records --test-threads=1` (2/2 passed on WARP) - `cargo check -p victory-gpu` and `cargo check -p victory-gpu --features diagnostics` (0 errors) - `cargo xtask policy` (`asset policy: 181 files ok`) - Live GTA VI 4K run on RTX 5070 Ti with `VICTORY_INDIRECT_WINDOW=0` + `VICTORY_INDIRECT_GATHER=1`: gathered up to 953 single indirect draws/frame in prelude (`no_fit 0`, `too_many_bufs 0`, `set_full 0`, `no_buf 0`), 0 crashes/TDR, 0 missing walls/geometry.
Dathinel commented 2026-11-25 21:05:56 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Dathinel on 2026-11-25T20:57:18Z.


One diagnostics issue for the proposed standalone mode at 6ce8cac: with VICTORY_INDIRECT_WINDOW=0, why_not is always usize::MAX. A failed gather (or an ineligible dispatch) can then execute indirect::bound, but the subsequent why_not < WINDOW_WHY.len() guard skips the counter. Consequently the “a pass of ours for” total can read zero while inline clamp dispatches are still being recorded. This matters if comparing standalone gather with windows + gather.

For a reproducible counter check, use a list with one eligible record and then one indirect dispatch with aligned arguments. With diagnostics on and window checking off, compare the gather hits and the independent “indirect commands bounded” counter. A separate count of successful inline clamps when windows are disabled would keep the denominator comparable without calling those commands window misses.

I applied the PR diff to our Series S test tree and built the diagnostics GPU tests on Windows. gathered_records_must_fit_the_clamp passed. The counter observation is from the recording path; I have no standalone FPS measurement. AI-assisted (Codex).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7174413911 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1070#issuecomment-7174413911). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T20:57:18Z. --- One diagnostics issue for the proposed standalone mode at `6ce8cac`: with `VICTORY_INDIRECT_WINDOW=0`, `why_not` is always `usize::MAX`. A failed gather (or an ineligible dispatch) can then execute `indirect::bound`, but the subsequent `why_not < WINDOW_WHY.len()` guard skips the counter. Consequently the “a pass of ours for” total can read zero while inline clamp dispatches are still being recorded. This matters if comparing standalone gather with windows + gather. For a reproducible counter check, use a list with one eligible record and then one indirect dispatch with aligned arguments. With diagnostics on and window checking off, compare the gather hits and the independent “indirect commands bounded” counter. A separate count of successful inline clamps when windows are disabled would keep the denominator comparable without calling those commands window misses. I applied the PR diff to our Series S test tree and built the diagnostics GPU tests on Windows. `gathered_records_must_fit_the_clamp` passed. The counter observation is from the recording path; I have no standalone FPS measurement. AI-assisted (Codex).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1070:upstream-pr/1070'
git switch 'upstream-pr/1070'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1070'
git switch 'upstream-pr/1070'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1070'
git switch 'upstream-pr/1070'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1070'
git switch 'main'
git merge --squash 'upstream-pr/1070'
git switch 'main'
git merge --ff-only 'upstream-pr/1070'
git switch 'main'
git merge 'upstream-pr/1070'
git push origin 'main'
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
fxceless/victory-fork!1068
No description provided.