native: run direct mesh dispatches (#353) #354

Merged
tiagonogueiraa-bit merged 1 commit from upstream-pr/354 into main 2026-11-27 16:14:20 +00:00
tiagonogueiraa-bit commented 2026-11-27 13:49:47 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T13:49:47Z.


Refs #353

What was wrong. On the native host, DispatchMesh (method 0x3f8) and DispatchMeshX with no argument address were dropped. They were only counted in the frame line's mesh= and warned about once. The indirect form already ran. docs/ROADMAP.md listed the direct form as open. The log attached to #343 (M3 Pro, Series S, prologue) shows mesh=5 by frame 2048: rare, but they are world draws that never ran.

Change.

  • Routing. Both direct forms now go to the new glue::dispatch_mesh. It does what the indirect branch of glue::execute_indirect does: it checks the bound pipeline with graphics(.., mesh = true), then encodes NativeList::dispatch_mesh(x, y, z). It also counts the dispatch as recorded and encoded, and updates the target trace and the pass note.
  • Group count (a guess). DispatchMeshX runs [x, 1, 1] groups, the same guess the D3D12 host's dispatch_mesh_x makes. flags and payload are ignored. The guess is written up next to the existing one in docs/native-host.md.
  • No mesh pipeline. Such a dispatch is still dropped, for the reason graphics logs: no pipeline, "a mesh dispatch of a vertex pipeline", or a guessed mesh pipeline. It is still counted in mesh=, so that field keeps its meaning: direct mesh dispatches the host did not run.
  • Indirect dispatches are unchanged. dropped_mesh is gone, and dropped_mesh_x now handles only indirect dispatches that could not run.

Tests (GPU, through the method table, built on an_indirect_dispatch_mesh_x_draws_the_groups_its_record_holds):

  • a_direct_dispatch_mesh_x_draws_its_groups: one group colours the target, zero groups leave it black, and neither is counted as dropped.
  • a_direct_dispatch_mesh_draws_its_groups: DispatchMesh(1, 1, 1) colours the target.

Both fail on main (the target stays black) and pass with this change.

Checks (macOS 27.2, Metal Shader Converter 4.0 beta 3):

  • cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 581 passed, 0 failed, 7 ignored.
  • cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings: clean.
  • cargo xtask policy: ok.

I haven't checked this in a game run. The next tester log should show mesh= at 0, or only the dispatches that have no mesh pipeline.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5527734264 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/354). Originally posted by [tiagonogueiraa-bit](https://github.com/tiagonogueiraa-bit) on 2026-11-27T13:49:47Z. --- Refs #353 **What was wrong.** On the native host, `DispatchMesh` (method 0x3f8) and `DispatchMeshX` with no argument address were dropped. They were only counted in the frame line's `mesh=` and warned about once. The indirect form already ran. `docs/ROADMAP.md` listed the direct form as open. The log attached to #343 (M3 Pro, Series S, prologue) shows `mesh=5` by frame 2048: rare, but they are world draws that never ran. **Change.** - **Routing.** Both direct forms now go to the new `glue::dispatch_mesh`. It does what the indirect branch of `glue::execute_indirect` does: it checks the bound pipeline with `graphics(.., mesh = true)`, then encodes `NativeList::dispatch_mesh(x, y, z)`. It also counts the dispatch as recorded and encoded, and updates the target trace and the pass note. - **Group count (a guess).** `DispatchMeshX` runs `[x, 1, 1]` groups, the same guess the D3D12 host's `dispatch_mesh_x` makes. `flags` and `payload` are ignored. The guess is written up next to the existing one in `docs/native-host.md`. - **No mesh pipeline.** Such a dispatch is still dropped, for the reason `graphics` logs: no pipeline, "a mesh dispatch of a vertex pipeline", or a guessed mesh pipeline. It is still counted in `mesh=`, so that field keeps its meaning: direct mesh dispatches the host did not run. - **Indirect dispatches** are unchanged. `dropped_mesh` is gone, and `dropped_mesh_x` now handles only indirect dispatches that could not run. **Tests** (GPU, through the method table, built on `an_indirect_dispatch_mesh_x_draws_the_groups_its_record_holds`): - `a_direct_dispatch_mesh_x_draws_its_groups`: one group colours the target, zero groups leave it black, and neither is counted as dropped. - `a_direct_dispatch_mesh_draws_its_groups`: `DispatchMesh(1, 1, 1)` colours the target. Both fail on main (the target stays black) and pass with this change. **Checks** (macOS 27.2, Metal Shader Converter 4.0 beta 3): - `cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask`: 581 passed, 0 failed, 7 ignored. - `cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings`: clean. - `cargo xtask policy`: ok. I haven't checked this in a game run. The next tester log should show `mesh=` at 0, or only the dispatches that have no mesh pipeline.
LakshanSivakumar commented 2026-11-27 16:15:21 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:15:21Z.


Merged in 4cf84c83. Before pushing I ran the tests (native arm64), Windows clippy, the policy check, a release build, and one headless game run of the exact tree (170 s, Series S): menus at 30 fps, the world entered at about 81 s and kept presenting to the end at about 1 frame a second, 0 GPU errors, no crash. Thanks.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7223042431 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/354#issuecomment-7223042431). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T16:15:21Z. --- Merged in 4cf84c83. Before pushing I ran the tests (native arm64), Windows clippy, the policy check, a release build, and one headless game run of the exact tree (170 s, Series S): menus at 30 fps, the world entered at about 81 s and kept presenting to the end at about 1 frame a second, 0 GPU errors, no crash. Thanks.
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
LakshanSivakumar/Native-Victory-macOS!354
No description provided.