startup: accept mesh parameter exports and pixel reads up to param31 #2788

Closed
tedin7 wants to merge 1 commit from upstream-pr/2796 into main
tedin7 commented 2026-11-26 10:08:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:08:51Z.


Part of #2413

What this unblocks: mesh shaders that export sparse high parameter indices (param18, param28) now reach the pixel pairing instead of stopping at the repository's own cap of 12.

What changed

  • MAX_PARAM in tools/mesh_param_link.py goes from 12 to 31: the RDNA 2 ISA (section 10.2, EXP targets) encodes param0..param31 as target 32 + N. The mesh export recognizer in tools/mesh_entry_aot.py accepts the same range (it spelled param0..12 in its pattern). MeshPixelStage takes its range from MAX_PARAM.
  • The D3D12 limit stays: SV_Position plus PARAM0..PARAMk plus the flat and binary16 shadow vectors must fit 32 vectors, and the signature carries every index up to the highest one, so param30 is the last index that fits beside the position; param31 is a valid index that the budget refuses (needs 33 vectors).

Tests

tests/mesh_param_link_check.py (also run by the existing mesh_param_link CTest entries on WARP and hardware):

  • New mesh variant exporting param0, param18 and param28, with a pixel shader reading attr0, attr18, attr28 (words recorded and decoded back to the expected assembly; reassembled by binary <llvm-mc>).
  • Linkage and HLSL checks for static and dynamic mesh lowering; boundary checks for param30 (accepted) and param31 (refused by the vector budget).
  • The old refusals now pin the new bounds: 0..31 in validate_linkage and MeshPixelStage, and an export of param32 is still an unsupported export.
  • D3D12 draws of the new pair (dynamic triangle and quad, static quad) against the same independent CPU rasterizer as the param12 case, plus two GPU negative controls (param0/param18 swapped, param28 zeroed) that must fail readback.

What stays open

The mesh stage still refuses other forms before the pixel pairing for the programs that export these indices; this only moves them past the parameter-range wall.

Verification:

  • python3 -B tests/mesh_param_link_check.py and python3 -B tests/mesh_param_link_check.py binary llvm-mc-19: pass.
  • tests/*check.py sweep against origin/main: no script changes result.
  • Win2025 WARP dev+release (the new draws and the two negative controls): pending Stage-2.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6624289075 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2796). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:08:51Z. --- Part of #2413 What this unblocks: mesh shaders that export sparse high parameter indices (param18, param28) now reach the pixel pairing instead of stopping at the repository's own cap of 12. ## What changed - `MAX_PARAM` in `tools/mesh_param_link.py` goes from 12 to 31: the RDNA 2 ISA (section 10.2, EXP targets) encodes `param0..param31` as target 32 + N. The mesh export recognizer in `tools/mesh_entry_aot.py` accepts the same range (it spelled `param0..12` in its pattern). `MeshPixelStage` takes its range from `MAX_PARAM`. - The D3D12 limit stays: SV_Position plus PARAM0..PARAMk plus the flat and binary16 shadow vectors must fit 32 vectors, and the signature carries every index up to the highest one, so `param30` is the last index that fits beside the position; `param31` is a valid index that the budget refuses (`needs 33 vectors`). ## Tests `tests/mesh_param_link_check.py` (also run by the existing `mesh_param_link` CTest entries on WARP and hardware): - New mesh variant exporting `param0`, `param18` and `param28`, with a pixel shader reading `attr0`, `attr18`, `attr28` (words recorded and decoded back to the expected assembly; reassembled by `binary <llvm-mc>`). - Linkage and HLSL checks for static and dynamic mesh lowering; boundary checks for `param30` (accepted) and `param31` (refused by the vector budget). - The old refusals now pin the new bounds: `0..31` in `validate_linkage` and `MeshPixelStage`, and an export of `param32` is still an unsupported export. - D3D12 draws of the new pair (dynamic triangle and quad, static quad) against the same independent CPU rasterizer as the param12 case, plus two GPU negative controls (param0/param18 swapped, param28 zeroed) that must fail readback. ## What stays open The mesh stage still refuses other forms before the pixel pairing for the programs that export these indices; this only moves them past the parameter-range wall. Verification: - `python3 -B tests/mesh_param_link_check.py` and `python3 -B tests/mesh_param_link_check.py binary llvm-mc-19`: pass. - `tests/*check.py` sweep against `origin/main`: no script changes result. - Win2025 WARP dev+release (the new draws and the two negative controls): pending Stage-2. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 11:02:51 +00:00
tedin7 commented 2026-11-26 11:02:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:13:04Z.


Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7189066028 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2796#issuecomment-7189066028). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:13:04Z. --- Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.

Pull request closed

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!2788
No description provided.