Skip to content

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

Open
artor410 wants to merge 1 commit into
Marvisak:mainfrom
artor410:indirect-mesh-dispatch
Open

artor410 wants to merge 1 commit into
Marvisak:mainfrom
artor410:indirect-mesh-dispatch

Conversation

@artor410

@artor410 artor410 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

AntoninMichelq pushed a commit to AntoninMichelq/VIctory that referenced this pull request Nov 24, 2026
…xecution) into the integration

The PR's indirect_on() gate (off unless VICTORY_INDIRECT in diagnostics
builds) is kept as a function but returns true: the branch had already
turned indirect execution on by default (35b054e) behind the clamp and
budget guards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
@jeremygold02

Copy link
Copy Markdown
Contributor

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.

@Raxstreams

Copy link
Copy Markdown

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
artor410 force-pushed the indirect-mesh-dispatch branch from 4b76fff to d5f41f5 Compare November 24, 2026 07:06
@artor410

Copy link
Copy Markdown
Contributor Author

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.

MfDev0 pushed a commit to MfDev0/victory that referenced this pull request Nov 24, 2026
DispatchMeshX with an indirect address was dropped, so GPU-driven mesh
dispatches (the world's) drew nothing (upstream Marvisak#756).
They now run through State::execute_indirect as one mesh dispatch (kind
10, stride 12) with its argument clamp; ones the host cannot run are
counted with the other dropped indirect work. A direct mesh dispatch with
an empty dimension runs nothing.

(ported from upstream Marvisak#24, commit d5f41f5; the test
module conflict with the copy-family test was resolved by keeping both)

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@dcastell1

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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.

yourmomsbasement pushed a commit to yourmomsbasement/VIctory_Dev that referenced this pull request Nov 24, 2026
…ied together

Merges Marvisak#72 Marvisak#347 Marvisak#1000 Marvisak#358 Marvisak#352 Marvisak#626 Marvisak#1152 Marvisak#1129 Marvisak#1203 Marvisak#24 Marvisak#642 Marvisak#427 Marvisak#485
Marvisak#550 Marvisak#174 Marvisak#1279 onto main (ffe310e), each head unchanged, no conflicts.

One change of mine: three of the PRs each add a `mod tests` at the end of
pipeline/host.rs, so the merge defines `tests` three times (E0428). The
second and third are named `library_tests` and `blend_tests`; nothing else
changes.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(367 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
edsuuu added a commit to edsuuu/VI-BR-PORT that referenced this pull request Nov 24, 2026
…ame wait bundle

Taken from the bundle: 64 MB stacks for pipeline workers (#1129), no
blending on integer render targets (#1152), root signature flag fallback
(#626), read-only depth read states (#485, on our stored rtvs/dsv and
bind_targets), enhanced texture barrier translation (#642, on our
recording_list so continuation segments get it), indirect mesh dispatch
(#24), the frame wait taking its tick before it sleeps (#174), and the
make.rs unit tests (#1203).

Kept from our side:
- pipeline/make.rs: early() starts every compute pipeline at creation
  (b4e8419); the per-pipeline wake pair, per-frame budget, wait_compute
  and copystat counters. The bundle's the_wait_budget_is_spent_once_per_frame
  test is dropped (written for its fixed BUDGET; our FrameBudget tests
  cover it); a_pipeline_is_made_once now holds the tests' serial lock.
- indirect.rs: our whole file (#40's overflow-safe clamp, DXC fallback for
  Wine, rectangle pass). #1279's structured-buffer clamp and its readback
  test (written for the old bound/done API) are left out.
- draw.rs: NOT_MADE counter, user_dword, typed table nulls
  (table_view_props, mirror_for_draw); the depth test calls readable()
  directly since our tables() needs a host pipeline.
- frame.rs: our `_tick` (the diagnostics log already names it).
- list.rs: execute_indirect's DISPATCH_SINGLE mapping in one place; our
  tests beside the bundle's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
DispatchMeshX with an indirect address used to be dropped. It now runs as
indirect execution of one mesh dispatch (stride 12), through the same
State::execute_indirect, argument clamp and VICTORY_INDIRECT switch as the
title's ExecuteIndirect; when it does not run it is counted with the other
indirect work dropped. The argument layout is inferred: those of a PC
indirect mesh dispatch, three 32-bit group counts.

A direct mesh dispatch with an empty y or z dimension now runs nothing
instead of its x groups, and y * z no longer overflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@artor410
artor410 force-pushed the indirect-mesh-dispatch branch from d5f41f5 to 857897a Compare November 24, 2026 23:06
@artor410

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs work. Two changes in crates/victory-gpu/src/list.rs:

  1. mesh_groups replaces the y * z != 1 check in the direct DispatchMesh path (which overflows in debug builds); a dispatch with any zero dimension now runs nothing, as in D3D12. This part is a clear fix.
  2. An indirect DispatchMeshX now goes to State::execute_indirect as kind 10, stride 12, one record. execute_indirect and indirect::bound in main handle that as the PR expects.

What blocks it: the argument layout for DispatchMeshX's indirect buffer is stated as inferred, and the supporting evidence (the title's stride-12 mesh signatures) is for a different entry point, ExecuteIndirect. Please add evidence for DispatchMeshX itself (the title's code that fills the buffer, or buffer contents observed at that call) and say what x means with an indirect address; or split the mesh_groups fix into its own PR, which could go in as is. The description also still mentions indirect_on() and VICTORY_INDIRECT, which no longer exist on main.

CI: the check run failed, but only on two victory-shader tests this PR does not touch (they fail on main too).


Generated by Claude Code

@artor410

Copy link
Copy Markdown
Contributor Author

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.

zhaibingye pushed a commit to zhaibingye/VIctory that referenced this pull request Nov 25, 2026
DispatchMesh checked y * z != 1, which overflows in debug builds, and a
dispatch with y or z = 0 still ran its x groups. mesh_groups runs none
when any dimension is 0, as D3D12 does.

Split from Marvisak#24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants