shader: mask primitive edge flags in staged mesh exports #3764

Merged
R0Y00 merged 3 commits from upstream-pr/3764 into main 2026-12-02 01:49:45 +00:00
R0Y00 commented 2026-12-01 17:03:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T17:03:37Z.


Refs #3763 and #3641.

Mesh primitive exports pack each 9-bit index alongside a separate edge flag. Mask the index consistently in both emission paths. Exercise the staged path with all three edge flags set while retaining the allocation and emission ordering checks.

Local validation: the related Mesh86 CTest selection passed 24/24 on the combined local tree. This PR carries only the primitive-index change and its regression case. The isolated PR head still needs CI. Geometry production and visible output are tracked separately.

Additional local reproduction on the combined Release build, with the same regression-test blob as this PR head:

ctest --test-dir out/build/mesh86-main-retest --no-tests=error -j 1 -R '^(native_direct_mesh|startup_mesh86_)'

16 passed, 0 failed, 0 skipped. Windows 11 x64, RTX 4060 Laptop GPU, NVIDIA driver 616.56, including WARP and hardware tests. Isolated PR-head CI is pending.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5590511496 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3764). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-01T17:03:37Z. --- Refs #3763 and #3641. Mesh primitive exports pack each 9-bit index alongside a separate edge flag. Mask the index consistently in both emission paths. Exercise the staged path with all three edge flags set while retaining the allocation and emission ordering checks. Local validation: the related Mesh86 CTest selection passed 24/24 on the combined local tree. This PR carries only the primitive-index change and its regression case. The isolated PR head still needs CI. Geometry production and visible output are tracked separately. Additional local reproduction on the combined Release build, with the same regression-test blob as this PR head: ```powershell ctest --test-dir out/build/mesh86-main-retest --no-tests=error -j 1 -R '^(native_direct_mesh|startup_mesh86_)' ``` 16 passed, 0 failed, 0 skipped. Windows 11 x64, RTX 4060 Laptop GPU, NVIDIA driver 616.56, including WARP and hardware tests. Isolated PR-head CI is pending.
lukaslw-lab commented 2026-12-01 20:41:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T20:41:49Z.

Review: APPROVED


Reviewed 66513d80 by reading the diff; not built or run.

Verdict: approve. The staged path no longer culls flagged triangles.

  • Before: with meshPackedIndices staged, the mask was 1023. Any index with its edge flag set (bits 9/19/29) became >= 512, hit the uge vertex_count check and culled the triangle (gfx1013_direct_mesh.inl:234-243). With 511, both paths read the same 9-bit index. Bit 31 still culls through slt packed, 0.
  • Fixture word 0x20280600 decodes to indices 0, 1 and 2, each with its flag set. mesh-masked-outputs reaches the staged branch (@meshPackedIndices is asserted). Under the old code it emits three and …, 1023, so the new not 1023 assertion fails there: the case is a working control.
  • No MUST, SHOULD or NIT.

Tests: native_direct_mesh (in the pr filter) carries the case, and CI ran it: Windows, gfx1013 and Linux jobs green at this head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6139786914 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3764#pullrequestreview-6139786914). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-12-01T20:41:49Z. **Review:** APPROVED --- Reviewed `66513d80` by reading the diff; not built or run. **Verdict: approve.** The staged path no longer culls flagged triangles. - Before: with `meshPackedIndices` staged, the mask was `1023`. Any index with its edge flag set (bits 9/19/29) became `>= 512`, hit the `uge vertex_count` check and culled the triangle (`gfx1013_direct_mesh.inl:234-243`). With `511`, both paths read the same 9-bit index. Bit 31 still culls through `slt packed, 0`. - Fixture word `0x20280600` decodes to indices 0, 1 and 2, each with its flag set. `mesh-masked-outputs` reaches the staged branch (`@meshPackedIndices` is asserted). Under the old code it emits three `and …, 1023`, so the new `not 1023` assertion fails there: the case is a working control. - No MUST, SHOULD or NIT. Tests: `native_direct_mesh` (in the `pr` filter) carries the case, and CI ran it: Windows, gfx1013 and Linux jobs green at this head.
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
R0Y00/Xbox2Windows!3764
No description provided.