GPU: route indirect dispatch_mesh_x through State::execute_indirect #1545

Open
n-romanovich wants to merge 2 commits from upstream-pr/1546 into main
n-romanovich commented 2026-11-24 19:01:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-24T19:01:55Z.


Summary

Fixes Issue #756.

Routes indirect DispatchMeshX calls (indirect != 0) through State::execute_indirect as a single MESH (kind = 10, stride = 12) command instead of silently dropping them, reusing the existing GPU argument clamp (indirect::bound) and command signature cache.

  • crates/victory-gpu/src/list.rs:
    • Route dispatch_mesh_x with indirect != 0 to s.execute_indirect(list, (10, 12, 1), indirect, None).
    • Increment INDIRECT and log once (with indirect address) if execute_indirect returns false.
    • Warn once if non-zero flags or payload are passed.
  • Added unit test indirect_dispatch_mesh_x_routes_through_execute_indirect.

Testing

Tested on Windows 11, NVIDIA GeForce RTX 5060 Ti:

  • cargo clippy --workspace --all-targets --locked -- -D warnings (pass)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings (pass)
  • cargo test -p victory-gpu --locked (51 passed, 0 failed, 1 ignored)

AI-assisted: implemented and reviewed with AI assistance.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589237543 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1546). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-24T19:01:55Z. --- ## Summary Fixes Issue #756. Routes indirect `DispatchMeshX` calls (`indirect != 0`) through `State::execute_indirect` as a single `MESH` (`kind = 10`, `stride = 12`) command instead of silently dropping them, reusing the existing GPU argument clamp (`indirect::bound`) and command signature cache. - `crates/victory-gpu/src/list.rs`: - Route `dispatch_mesh_x` with `indirect != 0` to `s.execute_indirect(list, (10, 12, 1), indirect, None)`. - Increment `INDIRECT` and log once (with `indirect` address) if `execute_indirect` returns `false`. - Warn once if non-zero `flags` or `payload` are passed. - Added unit test `indirect_dispatch_mesh_x_routes_through_execute_indirect`. ## Testing Tested on Windows 11, NVIDIA GeForce RTX 5060 Ti: - `cargo clippy --workspace --all-targets --locked -- -D warnings` (pass) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` (pass) - `cargo test -p victory-gpu --locked` (51 passed, 0 failed, 1 ignored) AI-assisted: implemented and reviewed with AI assistance.
acetonahard-code commented 2026-11-24 23:05:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T22:27:15Z.


Heads-up: #24 (opened yesterday) also routes indirect DispatchMeshX through execute_indirect instead of dropping it. The two conflict in list.rs.

Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current main (70564ae):

cargo test -p victory-gpu passed failed ignored
main 76 2 1
main + this PR 77 2 1
main, --all-features 79 2 -
main + this PR, --all-features 80 2 -
  • The new test passes.
  • No GPU test skipped for lack of a device.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.
  • Minor: cargo fmt --check would rewrap one block this PR adds (list.rs). main isn't rustfmt-clean either, so take it or leave it.
  • Two victory-gpu tests fail on current main on this NVIDIA card: dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views. That's the 1,000,000-view heap cap, see #1744. They fail the same way with this PR, and no other test does.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146248319 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1546#issuecomment-7146248319). Originally posted by [acetonahard-code](https://github.com/acetonahard-code) on 2026-11-24T22:27:15Z. --- Heads-up: #24 (opened yesterday) also routes indirect `DispatchMeshX` through `execute_indirect` instead of dropping it. The two conflict in `list.rs`. Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current `main` (70564ae): | `cargo test -p victory-gpu` | passed | failed | ignored | |---|---|---|---| | `main` | 76 | 2 | 1 | | `main` + this PR | 77 | 2 | 1 | | `main`, `--all-features` | 79 | 2 | - | | `main` + this PR, `--all-features` | 80 | 2 | - | - The new test passes. - No GPU test skipped for lack of a device. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. - Minor: `cargo fmt --check` would rewrap one block this PR adds (`list.rs`). `main` isn't rustfmt-clean either, so take it or leave it. - Two `victory-gpu` tests fail on current `main` on this NVIDIA card: `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`. That's the 1,000,000-view heap cap, see #1744. They fail the same way with this PR, and no other test does. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Marvisak commented 2026-11-25 02:06:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:30:33Z.


Automated triage for the maintainers.

Needs work. The new commit d1892690 addresses the wording points from the previous review in crates/victory-gpu/src/list.rs:

  • The doc comment on dispatch_mesh_x now says the 12-byte (x, y, z) record is inferred. That makes it honest, but an inference isn't evidence yet.
  • The test comment now matches what happens: execute_indirect returns false because no pipeline is bound. A new assertion checks that indirect == 0 takes the direct path and doesn't count a drop. On main an indirect call was dropped without counting, so the test now does tell the two versions apart.
  • dispatch_mesh's warning check now uses checked_mul.

What still decides the verdict is the same as for #24: evidence for the argument layout at this call. That means the title's code that fills the buffer, or buffer contents seen at a real DispatchMeshX with an indirect address. A tester on #24 reported that the sampled scene never makes such a call. Without the evidence, this routes GPU memory of unknown shape into a mesh dispatch.

Overlap. #24 and #1749 still make the same change in list.rs, and #2014 changes dispatch_mesh right next to it. Of the three, this one is the most complete (rebased, with a test), so it is a reasonable one to keep. Please agree with the other authors, and once the layout evidence is here this can move forward.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149625456 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1546#issuecomment-7149625456). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:30:33Z. --- <!-- victory-triage v1 head=d1892690c821128f770cfc4aaaeed29a4f21d14b verdict=needs-work at=2026-11-25T20:22:45Z --> Automated triage for the maintainers. **Needs work.** The new commit `d1892690` addresses the wording points from the previous review in `crates/victory-gpu/src/list.rs`: - The doc comment on `dispatch_mesh_x` now says the 12-byte `(x, y, z)` record is inferred. That makes it honest, but an inference isn't evidence yet. - The test comment now matches what happens: `execute_indirect` returns false because no pipeline is bound. A new assertion checks that `indirect == 0` takes the direct path and doesn't count a drop. On `main` an indirect call was dropped without counting, so the test now does tell the two versions apart. - `dispatch_mesh`'s warning check now uses `checked_mul`. What still decides the verdict is the same as for #24: **evidence for the argument layout at this call.** That means the title's code that fills the buffer, or buffer contents seen at a real `DispatchMeshX` with an indirect address. A tester on #24 reported that the sampled scene never makes such a call. Without the evidence, this routes GPU memory of unknown shape into a mesh dispatch. **Overlap.** #24 and #1749 still make the same change in `list.rs`, and #2014 changes `dispatch_mesh` right next to it. Of the three, this one is the most complete (rebased, with a test), so it is a reasonable one to keep. Please agree with the other authors, and once the layout evidence is here this can move forward. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
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/1546:upstream-pr/1546'
git switch 'upstream-pr/1546'

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