GPU: opt-in descriptor preflight for indirect calls #3543

Open
tharun-37 wants to merge 1 commit from upstream-pr/3543 into main
tharun-37 commented 2026-11-27 15:56:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tharun-37 on 2026-11-27T15:56:17Z.


Adds VICTORY_GPU_INDIRECT_DESCRIPTOR_PREFLIGHT=1, default off. When enabled, an indirect call that has passed its existing drop checks and copied its arguments prepares the descriptor records named by its shader tables before the GPU clamp dispatch.

Only the CPU-side record preparation moves. The clamp still runs after the earlier GPU writes, and resource states, copies and root bindings stay in bind after the clamp. The switch is read once per process.

Tests are synthetic: a placed-texture record left unkept until a table read is made by the preflight helper, and the switch truth table covers unset, 0, and 1. No game files, dumps, shader names, hashes or measured performance claims are involved.

Verification:

  • cargo clippy --workspace --all-targets --locked -- -D warnings passes.
  • cargo clippy -p victory-gpu --features diagnostics --all-targets --locked -- -D warnings passes.
  • cargo test -p victory-gpu --features diagnostics switch::tests: 5 passed, 0 failed.
  • cargo test -p victory-gpu --features diagnostics draw::tests::indirect_preflight_makes_a_known_table_record: 1 passed, 0 failed.
  • cargo xtask policy: 191 files ok.
  • Full workspace tests still show the same 3 pre-existing victory-gpu failures.

Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7222327099

AI-assisted (OpenCode).

<!-- greyfinch-sync:Marvisak/VIctory:issue:5529503989 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3543). Originally posted by [tharun-37](https://github.com/tharun-37) on 2026-11-27T15:56:17Z. --- Adds `VICTORY_GPU_INDIRECT_DESCRIPTOR_PREFLIGHT=1`, default off. When enabled, an indirect call that has passed its existing drop checks and copied its arguments prepares the descriptor records named by its shader tables before the GPU clamp dispatch. Only the CPU-side record preparation moves. The clamp still runs after the earlier GPU writes, and resource states, copies and root bindings stay in `bind` after the clamp. The switch is read once per process. Tests are synthetic: a placed-texture record left unkept until a table read is made by the preflight helper, and the switch truth table covers unset, `0`, and `1`. No game files, dumps, shader names, hashes or measured performance claims are involved. Verification: - `cargo clippy --workspace --all-targets --locked -- -D warnings` passes. - `cargo clippy -p victory-gpu --features diagnostics --all-targets --locked -- -D warnings` passes. - `cargo test -p victory-gpu --features diagnostics switch::tests`: 5 passed, 0 failed. - `cargo test -p victory-gpu --features diagnostics draw::tests::indirect_preflight_makes_a_known_table_record`: 1 passed, 0 failed. - `cargo xtask policy`: 191 files ok. - Full workspace tests still show the same 3 pre-existing `victory-gpu` failures. Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7222327099 AI-assisted (OpenCode).
futurepro62 commented 2026-11-27 21:07:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T21:07:57Z.


Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 51f4f3a (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: indirect_preflight_makes_a_known_table_record, indirect_preflight_is_default_off.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7228164130 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3543#issuecomment-7228164130). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-27T21:07:57Z. --- Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `51f4f3a` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **868 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `indirect_preflight_makes_a_known_table_record`, `indirect_preflight_is_default_off`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
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/3543:upstream-pr/3543'
git switch 'upstream-pr/3543'

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/3543'
git switch 'upstream-pr/3543'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3543'
git switch 'upstream-pr/3543'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3543'
git switch 'main'
git merge --squash 'upstream-pr/3543'
git switch 'main'
git merge --ff-only 'upstream-pr/3543'
git switch 'main'
git merge 'upstream-pr/3543'
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
Marvisak/VIctory!3543
No description provided.