GPU: run indirect mesh dispatches (DispatchMeshX) through indirect execution #24

Open
artor410 wants to merge 1 commit from upstream-pr/24 into main
artor410 commented 2026-11-23 23:18:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-23T23:18:20Z.


Summary

DispatchMeshX with an indirect address was dropped. It now goes through the indirect execution added in 8c26061, so it gets the same argument clamp, budget and INDIRECT_ARGUMENT transition as the title's ExecuteIndirect:

 dispatch_mesh_x(x, flags, indirect, payload)
-  indirect != 0: warn once, drop
+  indirect != 0:
+    State::execute_indirect(list, (MESH 10, stride 12, max 1), indirect, None)
+    not run        -> counted in INDIRECT (the frame-rate line's dropped indirect work)
   indirect == 0: dispatch_mesh(x)

Argument layout is inferred, not documented, and I can't add evidence for DispatchMeshX itself: I work without game files. Someone with the title would need to confirm it (buffer contents at that call): three 32-bit group counts (D3D12_DISPATCH_MESH_ARGUMENTS), as the title's own mesh dispatch signatures use (stride 12); x is then unused, flags and payload unknown. Noted in the doc comment.

Also on the direct DispatchMesh(x, y, z) path (split out as #2014, which can go in alone):

-  if y * z != 1: warn          // overflows in debug; y or z = 0 still ran x groups
-  dispatch_mesh(x)
+  mesh_groups(x, y, z): none if any dimension is 0, else x (y/z != 1 still warned once)

Evidence

No game files were used, and this is untested against the game. New unit tests in list.rs:

  • indirect_mesh_dispatches_not_run_are_counted: a title list's DispatchMeshX(0, 0, &[7, 1, 1], 0) with indirect execution off. Before: dropped silently, INDIRECT unchanged (fails). After: counted (passes).
  • mesh_dispatches_run_x_groups_unless_empty: (5,1,1) → 5, (5,0,1), (5,1,0), (0,1,1) → none, (5,2,3) → 5, (5,MAX,MAX) → 5 with no overflow.

cargo test -p victory-gpu: 38 passed. cargo clippy -p victory-gpu --all-targets (with and without diagnostics) adds no warnings, and cargo xtask policy passes. The changed lines are rustfmt-clean. On my machine victory-loader's load_probe fails for an unrelated reason: the checkout path is too long for link.exe when building the fixture.

Merge Danger

Door: two-way

Blast Radius: small

Indirect DispatchMeshX calls now run instead of being dropped (or are counted when they can't run); an empty-dimension DispatchMesh no longer draws.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6570860005 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24). Originally posted by [artor410](https://github.com/artor410) on 2026-11-23T23:18:20Z. --- ## Summary `DispatchMeshX` with an indirect address was dropped. It now goes through the indirect execution added in 8c26061, so it gets the same argument clamp, budget and `INDIRECT_ARGUMENT` transition as the title's `ExecuteIndirect`: ```diff dispatch_mesh_x(x, flags, indirect, payload) - indirect != 0: warn once, drop + indirect != 0: + State::execute_indirect(list, (MESH 10, stride 12, max 1), indirect, None) + not run -> counted in INDIRECT (the frame-rate line's dropped indirect work) indirect == 0: dispatch_mesh(x) ``` Argument layout is **inferred, not documented**, and I can't add evidence for `DispatchMeshX` itself: I work without game files. Someone with the title would need to confirm it (buffer contents at that call): three 32-bit group counts (`D3D12_DISPATCH_MESH_ARGUMENTS`), as the title's own mesh dispatch signatures use (stride 12); `x` is then unused, `flags` and `payload` unknown. Noted in the doc comment. Also on the direct `DispatchMesh(x, y, z)` path (split out as #2014, which can go in alone): ```diff - if y * z != 1: warn // overflows in debug; y or z = 0 still ran x groups - dispatch_mesh(x) + mesh_groups(x, y, z): none if any dimension is 0, else x (y/z != 1 still warned once) ``` ## Evidence No game files were used, and this is **untested against the game**. New unit tests in `list.rs`: - `indirect_mesh_dispatches_not_run_are_counted`: a title list's `DispatchMeshX(0, 0, &[7, 1, 1], 0)` with indirect execution off. **Before:** dropped silently, `INDIRECT` unchanged (fails). **After:** counted (passes). - `mesh_dispatches_run_x_groups_unless_empty`: `(5,1,1) → 5`, `(5,0,1)`, `(5,1,0)`, `(0,1,1) → none`, `(5,2,3) → 5`, `(5,MAX,MAX) → 5` with no overflow. `cargo test -p victory-gpu`: 38 passed. `cargo clippy -p victory-gpu --all-targets` (with and without `diagnostics`) adds no warnings, and `cargo xtask policy` passes. The changed lines are rustfmt-clean. On my machine `victory-loader`'s `load_probe` fails for an unrelated reason: the checkout path is too long for `link.exe` when building the fixture. ## Merge Danger **Door:** two-way **Blast Radius:** small Indirect `DispatchMeshX` calls now run instead of being dropped (or are counted when they can't run); an empty-dimension `DispatchMesh` no longer draws. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jeremygold02 commented 2026-11-24 06:55:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:14:39Z.


Thanks @artor410 for this change. I tested the open PR at head 4b76fffb956fdc3c813f3573a26e093ae7969fb4 with:

cargo test -p victory-gpu --lib -- --test-threads=1

Result: 38 passed, 0 failed. This includes indirect_mesh_dispatches_not_run_are_counted, which checks that an indirect mesh dispatch is counted when indirect execution is disabled, and mesh_dispatches_run_x_groups_unless_empty, which covers zero dimensions, non-unit y/z dimensions, and u32::MAX values without overflow.

These are library unit tests; no title or game runtime was launched. The added regression cases are in list.rs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121839685 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7121839685). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T04:14:39Z. --- Thanks @artor410 for this change. I tested the open PR at head `4b76fffb956fdc3c813f3573a26e093ae7969fb4` with: ``` cargo test -p victory-gpu --lib -- --test-threads=1 ``` Result: 38 passed, 0 failed. This includes `indirect_mesh_dispatches_not_run_are_counted`, which checks that an indirect mesh dispatch is counted when indirect execution is disabled, and `mesh_dispatches_run_x_groups_unless_empty`, which covers zero dimensions, non-unit y/z dimensions, and `u32::MAX` values without overflow. These are library unit tests; no title or game runtime was launched. The added regression cases are in [list.rs](https://github.com/Marvisak/VIctory/blob/4b76fffb956fdc3c813f3573a26e093ae7969fb4/crates/victory-gpu/src/list.rs).
Raxstreams commented 2026-11-24 06:55:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Raxstreams on 2026-11-24T05:08:37Z.


Ported the indirect DispatchMeshX path onto a Windows integration branch where normal ExecuteIndirect is already enabled. Both mesh_dispatches_run_x_groups_unless_empty and indirect_mesh_dispatches_not_run_are_counted passed on the RTX 3080 Ti host. Our sampled scene already uses ordinary indirect mesh draws. I have not observed a DispatchMeshX call with an indirect address in this scene.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122664492 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7122664492). Originally posted by [Raxstreams](https://github.com/Raxstreams) on 2026-11-24T05:08:37Z. --- Ported the indirect DispatchMeshX path onto a Windows integration branch where normal ExecuteIndirect is already enabled. Both mesh_dispatches_run_x_groups_unless_empty and indirect_mesh_dispatches_not_run_are_counted passed on the RTX 3080 Ti host. Our sampled scene already uses ordinary indirect mesh draws. I have not observed a DispatchMeshX call with an indirect address in this scene.
artor410 commented 2026-11-24 07:08:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-24T07:06:27Z.


Rebased onto main (d5f41f5): indirect execution is now always on there, so the indirect DispatchMeshX path runs without the removed VICTORY_INDIRECT switch; cargo test -p victory-gpu --lib: 45 passed. Thanks @jeremygold02 and @Raxstreams for testing.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7124623449 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7124623449). Originally posted by [artor410](https://github.com/artor410) on 2026-11-24T07:06:27Z. --- Rebased onto main (d5f41f5): indirect execution is now always on there, so the indirect DispatchMeshX path runs without the removed VICTORY_INDIRECT switch; `cargo test -p victory-gpu --lib`: 45 passed. Thanks @jeremygold02 and @Raxstreams for testing.
dcastell1 commented 2026-11-24 12:04:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dcastell1 on 2026-11-24T11:34:44Z.


Verified as part of the world-stack several testers are using, on NVIDIA GeForce RTX 5090, driver 621.24, Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build:

main@ffe310e (342 passed, 0 failed, 6 ignored)
+ this PR
+ #24 (indirect mesh dispatches)
+ MIN_DYNAMIC = 1 << 18 (issue #747)
cargo test --workspace  ->  346 passed; 0 failed; 6 ignored   (exit 0)

So on Blackwell the stack builds and the workspace is green with it applied; #413 is the one that does not apply to current main (it is marked conflicting). What I cannot answer from here is the G-buffer effect — this box has no retail package, so the frame counts have to come from a machine that runs the title.

AI-assisted (opencode): applied the stack to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7130277299 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7130277299). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T11:34:44Z. --- Verified as part of the world-stack several testers are using, on **NVIDIA GeForce RTX 5090, driver 621.24, Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build**: ``` main@ffe310e (342 passed, 0 failed, 6 ignored) + this PR + #24 (indirect mesh dispatches) + MIN_DYNAMIC = 1 << 18 (issue #747) cargo test --workspace -> 346 passed; 0 failed; 6 ignored (exit 0) ``` So on Blackwell the stack builds and the workspace is green with it applied; #413 is the one that does not apply to current main (it is marked conflicting). What I cannot answer from here is the G-buffer effect — this box has no retail package, so the frame counts have to come from a machine that runs the title. AI-assisted (opencode): applied the stack to a built tree, ran the suite, reverted it.
EduBertozzi commented 2026-11-24 13:02:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by EduBertozzi on 2026-11-24T12:50:15Z.


Windows 10 + Pascal data point (tests only, no game run).

Setup: Windows 10 Education 22H2 (19045), GTX 1060 6 GB (582.66), Rust 1.98.1, debug. I tested d5f41f5 merged (cleanly) onto my mesh fallback branch from #3, which is today's main plus a compute form of mesh programs. That branch runs indirect mesh dispatches through State::execute_indirect too, so it is the case where both meet.

  • cargo test -p victory-gpu: 59 passed, 0 failed, including mesh_dispatches_run_x_groups_unless_empty and indirect_mesh_dispatches_not_run_are_counted.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.

Because this sends DispatchMeshX to execute_indirect as kind 10 (stride 12, one record), a host without mesh shaders that takes the fallback also gets these dispatches, with no change on either side.

AI-assisted (Claude Code); runs on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7131985787 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7131985787). Originally posted by [EduBertozzi](https://github.com/EduBertozzi) on 2026-11-24T12:50:15Z. --- Windows 10 + Pascal data point (tests only, no game run). **Setup:** Windows 10 Education 22H2 (19045), GTX 1060 6 GB (582.66), Rust 1.98.1, debug. I tested `d5f41f5` merged (cleanly) onto my mesh fallback branch from #3, which is today's `main` plus a compute form of mesh programs. That branch runs indirect mesh dispatches through `State::execute_indirect` too, so it is the case where both meet. - `cargo test -p victory-gpu`: **59 passed, 0 failed**, including `mesh_dispatches_run_x_groups_unless_empty` and `indirect_mesh_dispatches_not_run_are_counted`. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. Because this sends `DispatchMeshX` to `execute_indirect` as kind 10 (stride 12, one record), a host without mesh shaders that takes the fallback also gets these dispatches, with no change on either side. AI-assisted (Claude Code); runs on my machine.
artor410 commented 2026-11-25 00:06:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-24T23:06:43Z.


Rebased onto main (70564ae), conflict in list.rs tests resolved (kept both). Mesh tests pass; dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views fail on main too, unrelated.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147026200 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7147026200). Originally posted by [artor410](https://github.com/artor410) on 2026-11-24T23:06:43Z. --- Rebased onto main (70564ae), conflict in list.rs tests resolved (kept both). Mesh tests pass; `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views` fail on main too, unrelated.
Marvisak commented 2026-11-25 01:07:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:23:35Z.


Automated triage for the maintainers.

Needs work. The head is unchanged since the last note. crates/victory-gpu/src/list.rs still has two changes:

  1. The mesh_groups fix to direct DispatchMesh. It is now also in #2014, which carries it alone.
  2. Indirect DispatchMeshX goes through State::execute_indirect as kind 10, stride 12, one record.

Part 2 still rests on an inferred argument layout, and no one has shown it running; the Windows tester above reports that the sampled scene never calls DispatchMeshX with an indirect address. To change the verdict, this needs evidence of the buffer layout at that call (the title's code that fills it, or buffer contents seen at that call). Once #2014 lands, please also rebase so mesh_groups is not carried twice.

CI: check failed on the old base (70564ae), in victory-shader tests this PR does not touch. A rebase will re-run it.

On your reply: thanks for the split and the cleaned-up description. Without the evidence this can stay open, but it can't be merged yet.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148461970 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7148461970). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:23:35Z. --- <!-- victory-triage v1 head=857897aa580b8a4a4f699f8e328c96fd007f3e5f verdict=needs-work at=2026-11-25T03:26:00Z --> Automated triage for the maintainers. **Needs work.** The head is unchanged since the last note. `crates/victory-gpu/src/list.rs` still has two changes: 1. The `mesh_groups` fix to direct `DispatchMesh`. It is now also in #2014, which carries it alone. 2. Indirect `DispatchMeshX` goes through `State::execute_indirect` as kind 10, stride 12, one record. Part 2 still rests on an inferred argument layout, and no one has shown it running; the Windows tester above reports that the sampled scene never calls `DispatchMeshX` with an indirect address. To change the verdict, this needs evidence of the buffer layout at that call (the title's code that fills it, or buffer contents seen at that call). Once #2014 lands, please also rebase so `mesh_groups` is not carried twice. CI: `check` failed on the old base (70564ae), in `victory-shader` tests this PR does not touch. A rebase will re-run it. On your reply: thanks for the split and the cleaned-up description. Without the evidence this can stay open, but it can't be merged yet. --- _Generated by [Claude Code](https://claude.ai/code)_
artor410 commented 2026-11-25 04:06:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by artor410 on 2026-11-25T03:07:30Z.


Split the mesh_groups fix into #2014. I can't supply DispatchMeshX buffer evidence (no game files here), so this stays open for someone with the title to confirm the layout; stale VICTORY_INDIRECT mentions removed from the description.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151612925 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/24#issuecomment-7151612925). Originally posted by [artor410](https://github.com/artor410) on 2026-11-25T03:07:30Z. --- Split the `mesh_groups` fix into #2014. I can't supply `DispatchMeshX` buffer evidence (no game files here), so this stays open for someone with the title to confirm the layout; stale `VICTORY_INDIRECT` mentions removed from the description.
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/24:upstream-pr/24'
git switch 'upstream-pr/24'

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