shader: stop the mesh back-edge scan at an unknown word #3893

Merged
lukaslw-lab merged 1 commit from upstream-pr/3893 into main 2026-12-02 22:06:21 +00:00
lukaslw-lab commented 2026-12-02 21:53:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T21:53:40Z.


Change

The mesh back-edge scan from #3707 decodes the whole code blob and throws at a word without a known opcode, before the forward pass reaches the stage's first refusal. The scan now stops at that word. The forward pass still refuses the word if it reaches it, and any back edge the scan did not record (unsupported mesh scalar branch destination).

Fixes #3892. Part of #3703.

Verification

Commit 38652459e on main c01afe21f, Windows 10 19045, release and dev.

  • ctest -R '^native_direct_mesh$': passes in both. With src/gfx1013_direct_mesh.inl reverted it fails in dev at the new trailing-data case: unknown gfx1013 opcode 0 at byte 76.
  • ctest -R mesh -j 4: 244 tests in each build: 128 passed, 86 skipped, 30 failed.
    • 28 *_hardware failures, seen on this host (RTX 3080 Ti, 32.0.16.1047) before this change too.
    • startup_mesh86_translate_hardware (CreatePipelineState failed 0x80070057) and startup_mesh86_present_warp (request pass exited 77: no mesh shaders on this WARP): both fail the same way in dev without the fix.
  • Mesh census on 25f8ebec5 (6,685 distinct programs; local capture, counts only), the same scan change before a comment rewording:
Main With the fix
unknown gfx1013 opcode 257 0
Translate 1,890 1,890
Lost / gained 0 / 0

Evidence and follow-up

  • trailing-data and scalar-loop-trailing-data in tests/native_direct_mesh_check.py are source-built: zero words after s_endpgm, without and with a scalar loop.
  • Where the unknown words sit in the captured programs is not established; the fix does not depend on it.
  • The census is local data. The fixtures verify the scan behavior.
  • docs/experiments/native-mesh-scalar-loop.md states the stop rule.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5615371767 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3893). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-12-02T21:53:40Z. --- ## Change The mesh back-edge scan from #3707 decodes the whole code blob and throws at a word without a known opcode, before the forward pass reaches the stage's first refusal. The scan now stops at that word. The forward pass still refuses the word if it reaches it, and any back edge the scan did not record (`unsupported mesh scalar branch destination`). Fixes #3892. Part of #3703. ## Verification Commit `38652459e` on main `c01afe21f`, Windows 10 19045, release and dev. - `ctest -R '^native_direct_mesh$'`: passes in both. With `src/gfx1013_direct_mesh.inl` reverted it fails in dev at the new `trailing-data` case: `unknown gfx1013 opcode 0 at byte 76`. - `ctest -R mesh -j 4`: 244 tests in each build: 128 passed, 86 skipped, 30 failed. - 28 `*_hardware` failures, seen on this host (RTX 3080 Ti, 32.0.16.1047) before this change too. - `startup_mesh86_translate_hardware` (`CreatePipelineState failed 0x80070057`) and `startup_mesh86_present_warp` (`request pass exited 77`: no mesh shaders on this WARP): both fail the same way in dev without the fix. - Mesh census on `25f8ebec5` (6,685 distinct programs; local capture, counts only), the same scan change before a comment rewording: | | Main | With the fix | |---|---:|---:| | `unknown gfx1013 opcode` | 257 | 0 | | Translate | 1,890 | 1,890 | | Lost / gained | | 0 / 0 | ## Evidence and follow-up - `trailing-data` and `scalar-loop-trailing-data` in `tests/native_direct_mesh_check.py` are source-built: zero words after `s_endpgm`, without and with a scalar loop. - Where the unknown words sit in the captured programs is not established; the fix does not depend on it. - The census is local data. The fixtures verify the scan behavior. - `docs/experiments/native-mesh-scalar-loop.md` states the stop rule. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-12-02 22:05:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T22:05:47Z.

Review: APPROVED


Reviewed 38652459e. The pre-scan stops at the unknown word. The forward pass still decodes reached instructions and requires a recorded back edge. On Windows MSVC Debug, I built compile_dxil from the PR head and ran ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^native_direct_mesh$' (1 passed). Restoring only the old scanner locally while keeping the new tests reproduced trailing-data failing with unknown gfx1013 opcode 0 at byte 76. The trial merge with main at 606027a1 was clean. Windows, Linux Python, and gfx1013 fixture CI are green on this head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6159857541 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3893#pullrequestreview-6159857541). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T22:05:47Z. **Review:** APPROVED --- Reviewed `38652459e`. The pre-scan stops at the unknown word. The forward pass still decodes reached instructions and requires a recorded back edge. On Windows MSVC Debug, I built `compile_dxil` from the PR head and ran `ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^native_direct_mesh$'` (1 passed). Restoring only the old scanner locally while keeping the new tests reproduced `trailing-data` failing with `unknown gfx1013 opcode 0 at byte 76`. The trial merge with `main` at `606027a1` was clean. Windows, Linux Python, and gfx1013 fixture CI are green on 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!3893
No description provided.