GPU: a mesh dispatch with an empty dimension runs nothing #2012

Open
artor410 wants to merge 1 commit from upstream-pr/2014 into main
artor410 commented 2026-11-25 03:07:15 +00:00 (Migrated from github.com)

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


Summary

Split from #24, as the triage there suggested: only the direct DispatchMesh fix.

-  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 (as D3D12), else x (y/z != 1 still warned once)

Evidence

No game files used; untested against the game. New test mesh_dispatches_run_x_groups_unless_empty: (5,1,1) → 5; (0,1,1), (5,0,1), (5,1,0) → none; (5,2,3) → 5; (5,MAX,MAX) → 5 with no overflow.

cargo test -p victory-gpu --lib: 142 passed, 2 failed (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, which fail on main too). Changed lines are rustfmt-clean.

Merge Danger

Door: two-way

Blast Radius: small. Only a DispatchMesh with a zero dimension changes (it no longer draws).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6596271621 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2014). Originally posted by [artor410](https://github.com/artor410) on 2026-11-25T03:07:15Z. --- ## Summary Split from #24, as the triage there suggested: only the direct `DispatchMesh` fix. ```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 (as D3D12), else x (y/z != 1 still warned once) ``` ## Evidence No game files used; **untested against the game**. New test `mesh_dispatches_run_x_groups_unless_empty`: `(5,1,1) → 5`; `(0,1,1)`, `(5,0,1)`, `(5,1,0) → none`; `(5,2,3) → 5`; `(5,MAX,MAX) → 5` with no overflow. `cargo test -p victory-gpu --lib`: 142 passed, 2 failed (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, which fail on main too). Changed lines are rustfmt-clean. ## Merge Danger **Door:** two-way **Blast Radius:** small. Only a `DispatchMesh` with a zero dimension changes (it no longer draws). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-25 04:06:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T03:33:13Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Mesh dispatch with an empty dimension runs nothing — degenerate-dispatch guard; cheap correctness fix.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051461446 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2014#pullrequestreview-6051461446). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T03:33:13Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Mesh dispatch with an empty dimension runs nothing — degenerate-dispatch guard; cheap correctness fix.
upipibi commented 2026-11-25 04:06:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-25T03:20:46Z.


Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at 10be798. victory-gpu: 142 passed, 2 failed, 2 ignored; the new mesh_dispatches_run_x_groups_unless_empty passes. The 2 are #1744's NVIDIA failures on main (dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, the heap-cap ones). Same as main on this hardware. Not run: a title.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151827427 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2014#issuecomment-7151827427). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-25T03:20:46Z. --- Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at `10be798`. `victory-gpu`: 142 passed, 2 failed, 2 ignored; the new `mesh_dispatches_run_x_groups_unless_empty` passes. The 2 are #1744's NVIDIA failures on `main` (`dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`, the heap-cap ones). Same as `main` on this hardware. Not run: a title. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 10:07:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:18:18Z.


Automated triage for the maintainers.

Merge candidate. In crates/victory-gpu/src/list.rs, state::dispatch_mesh now drops a DispatchMesh that has a zero dimension, as the D3D12 API does. Before, it ran x groups even when y or z was 0. It also replaces the y * z != 1 check, which overflows u32 and panics in a debug build (inside an extern "system" function), with separate checks on y and z. The warning for y or z above 1 is unchanged, DispatchMeshX is untouched, and the new pure mesh_groups has a test for the edge cases. This is the part split out of #24 at triage's request, and I found no other open PR touching this function.

Recommending a look, not approving.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158150132 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2014#issuecomment-7158150132). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T09:18:18Z. --- <!-- victory-triage v1 head=10be798007f2430c33012a916562625abf15d28a verdict=merge-candidate at=2026-11-25T09:19:30Z --> Automated triage for the maintainers. **Merge candidate.** In `crates/victory-gpu/src/list.rs`, `state::dispatch_mesh` now drops a `DispatchMesh` that has a zero dimension, as the D3D12 API does. Before, it ran `x` groups even when `y` or `z` was 0. It also replaces the `y * z != 1` check, which overflows `u32` and panics in a debug build (inside an `extern "system"` function), with separate checks on `y` and `z`. The warning for y or z above 1 is unchanged, `DispatchMeshX` is untouched, and the new pure `mesh_groups` has a test for the edge cases. This is the part split out of #24 at triage's request, and I found no other open PR touching this function. Recommending a look, not approving. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 02:07:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:35:17Z.


Code review and RTX 5090 + WARP verification at head 10be798007f2 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/list.rs:1508-1527):
    • mesh_groups(x, y, z) returns None when any dimension is 0 and replaces y * z != 1 with y != 1 || z != 1 (also eliminating u32 overflow in debug builds, verified by mesh_groups(5, u32::MAX, u32::MAX) == Some(5)).
    • Skipping with_state/host_pipeline/DispatchMesh cleanly leaves lazy State coherent for subsequent draws. Minor non-blocking note: dispatch_mesh_x (list.rs:1528) does not share this x == 0 early-out yet (easy follow-up if desired).
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings
    • RTX 5090 (draw::tests pipeline:: list:: --test-threads 1): 48/48 passed; WARP (--features diagnostics, same filter): 51/51 passed.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179922238 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2014#issuecomment-7179922238). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:35:17Z. --- Code review and RTX 5090 + WARP verification at head `10be798007f2` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/list.rs:1508-1527`)**: - `mesh_groups(x, y, z)` returns `None` when any dimension is `0` and replaces `y * z != 1` with `y != 1 || z != 1` (also eliminating `u32` overflow in debug builds, verified by `mesh_groups(5, u32::MAX, u32::MAX) == Some(5)`). - Skipping `with_state`/`host_pipeline`/`DispatchMesh` cleanly leaves lazy `State` coherent for subsequent draws. Minor non-blocking note: `dispatch_mesh_x` (`list.rs:1528`) does not share this `x == 0` early-out yet (easy follow-up if desired). - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): 0 warnings - RTX 5090 (`draw::tests pipeline:: list:: --test-threads 1`): **48/48 passed**; WARP (`--features diagnostics`, same filter): **51/51 passed**. LGTM.
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/2014:upstream-pr/2014'
git switch 'upstream-pr/2014'

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