Shaders: avoid overwriting mesh indices when every slot is exported #3299

Open
github-bot wants to merge 1 commit from github-bot/gh-3299 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 16:23 UTC · original
andrewpozdnakov7-jpg:fix/warp-mesh-primitive-index-overwrite → main · +12 −0 · 1 files · 1 commits · open

On app-local WARP 1.0.22, the existing mesh edge-flag test renders 0 of 256 texels even for its unflagged triangle. The generated DXIL writes a degenerate primitive at entry and later writes the exported indices to the same slot.

I confirmed the API behavior with a native HLSL control. Using the same pipeline and DXC -Od, one EmitIndices(0,1,2) per slot draws the expected frame. Adding an earlier EmitIndices(0,0,0) per slot yields a blank frame. DXC disassembly shows one and two writes respectively. The DirectX mesh shader spec says the last write defines the indices. DirectX mesh shader specification

Skip the preliminary write only for a straight-line shader with one unguarded primitive export and exactly one primitive slot per thread. The export overwrites every slot in that case, so the initialization is redundant. Task claim

Verification

  • Same synthetic draw on main 63bcca4 and this revision. With the patch, the two visible variants match all 256 expected colors and the culled variant lights zero texels.
  • Forced WARP shader lib suite with app-local WARP 1.0.22 and Agility 1.620.2 goes from 298 passed / 4 failed / 3 ignored to 299 passed / 3 failed / 3 ignored. The three remaining failures also occur on main (gather adapter selection and two lane-permutation tests).
  • Strict shader Clippy with and without all features, and policy passed.

All fixtures are synthetic. AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 16:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/3299) `andrewpozdnakov7-jpg:fix/warp-mesh-primitive-index-overwrite` → `main` · +12 −0 · 1 files · 1 commits · open On app-local WARP 1.0.22, the existing mesh edge-flag test renders 0 of 256 texels even for its unflagged triangle. The generated DXIL writes a degenerate primitive at entry and later writes the exported indices to the same slot. I confirmed the API behavior with a native HLSL control. Using the same pipeline and DXC `-Od`, one `EmitIndices(0,1,2)` per slot draws the expected frame. Adding an earlier `EmitIndices(0,0,0)` per slot yields a blank frame. DXC disassembly shows one and two writes respectively. The DirectX mesh shader spec says the last write defines the indices. [DirectX mesh shader specification](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#vertex-indices) Skip the preliminary write only for a straight-line shader with one unguarded primitive export and exactly one primitive slot per thread. The export overwrites every slot in that case, so the initialization is redundant. [Task claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) ## Verification - Same synthetic draw on main `63bcca4` and this revision. With the patch, the two visible variants match all 256 expected colors and the culled variant lights zero texels. - Forced WARP shader lib suite with app-local WARP 1.0.22 and Agility 1.620.2 goes from 298 passed / 4 failed / 3 ignored to 299 passed / 3 failed / 3 ignored. The three remaining failures also occur on main (gather adapter selection and two lane-permutation tests). - Strict shader Clippy with and without all features, and policy passed. All fixtures are synthetic. AI-assisted with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:27:46 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 16:34 UTC · original

I merged exact #3299 head 8f01cab with the published #3267 + #2997 integration b1ff815 without conflicts. On app-local WARP 1.0.22 / Agility 1.620.2 with DXIL 1.9.2609.5, two fresh full shader runs each passed 302 tests, with 0 failures and 3 ignored. The mesh draw that failed in both prior full runs now passes. Earlier #3267 + #2997 results

The separate fresh-process series in #2997 still establishes intermittent divergence in its 19-active-lane case. These two full runs confirm the mesh change composes with the gather and permute changes on this host. Intermittent case

AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 16:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/3299#issuecomment-7197832033) I merged exact #3299 head `8f01cab` with the published #3267 + #2997 integration `b1ff815` without conflicts. On app-local WARP 1.0.22 / Agility 1.620.2 with DXIL 1.9.2609.5, two fresh full shader runs each passed **302 tests**, with **0 failures** and **3 ignored**. The mesh draw that failed in both prior full runs now passes. [Earlier #3267 + #2997 results](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3267) The separate fresh-process series in #2997 still establishes intermittent divergence in its 19-active-lane case. These two full runs confirm the mesh change composes with the gather and permute changes on this host. [Intermittent case](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2997) AI-assisted with Codex.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 16:50 UTC · original · approved these changes

Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):

  • Skipping the preliminary degenerate-triangle index write when threads == mesh.max_primitives and a single-block mesh shader ([LaneExit::End]) has one unguarded Target::Primitive export is tight and sound, avoiding WARP 1.0.22 keeping the preliminary write.
  • cargo test -p victory-shader --lib emit::tests:: -- --test-threads=1: 17 passed, 0 failed (including edge_flagged_triangles_draw_as_unflagged_ones and primitive_export_indices_drop_the_edge_flags).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 16:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/3299#pullrequestreview-6077832103) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP): - Skipping the preliminary degenerate-triangle index write when `threads == mesh.max_primitives` and a single-block mesh shader (`[LaneExit::End]`) has one unguarded `Target::Primitive` export is tight and sound, avoiding WARP 1.0.22 keeping the preliminary write. - `cargo test -p victory-shader --lib emit::tests:: -- --test-threads=1`: 17 passed, 0 failed (including `edge_flagged_triangles_draw_as_unflagged_ones` and `primitive_export_indices_drop_the_edge_flags`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:01 UTC · original

The edge-flag fix also composes with the direct mesh group-index candidate from #2624. On the exact integration, the edge-flag draw passed on app-local WARP 1.0.22 in three fresh runs. Each 24-group test still visited every index once, and GPU diagnostics passed with 249 tests, 0 failed and 1 ignored. Integration details in #2624. AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 17:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3299#issuecomment-7198398089) The edge-flag fix also composes with the direct mesh group-index candidate from #2624. On the exact integration, the edge-flag draw passed on app-local WARP 1.0.22 in three fresh runs. Each 24-group test still visited every index once, and GPU diagnostics passed with 249 tests, 0 failed and 1 ignored. [Integration details in #2624](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2624). AI-assisted with Codex.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3299/head:github-bot/gh-3299'
git switch 'github-bot/gh-3299'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3299'
git switch 'github-bot/gh-3299'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3299'
git switch 'github-bot/gh-3299'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3299'
git switch 'main'
git merge --squash 'github-bot/gh-3299'
git switch 'main'
git merge --ff-only 'github-bot/gh-3299'
git switch 'main'
git merge 'github-bot/gh-3299'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3299
No description provided.