shader: lower mesh param0..param12 exports and gfx2hlsl pixel linkage #2419

Merged
R0D4X merged 2 commits from upstream-pr/2427 into main 2026-11-26 07:18:06 +00:00
R0D4X commented 2026-11-25 16:26:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-25T16:26:50Z.


Summary

  • Implement #2413 Item T4 (Parameter exports up to param12 and their pairing with the pixel stage inputs) across the bounded mesh translators and gfx2hlsl.py.
  • Add tools/mesh_param_link.py (MAX_PARAM = 12 per AMD RDNA 2 ISA §10.2 EXP target 32 + N, MAX_VERTEX_VECTORS = 32 per D3D12 SM 6.5 vertex output limit) with ParamLinkage, validate_linkage, merge_wave_params, hlsl_param_fields, and hlsl_param_writes (dense PARAM0..PARAM12, nointerpolation uint4 FPARAM*, HPARAML*/HPARAMH* binary16 halves, and zero-initialized unexported gap slots), preserving legacy TEXCOORD0 for param0-only callers without an explicit ParamLinkage.
  • Extend tools/mesh_entry_aot.py and tools/mesh_dynamic_aot.py to decode and validate exp param0..exp param12 across waves and dynamic variants (keeping CLI __main__ untouched to avoid overlap with #2394/#2407).
  • Add MeshPixelStage(Pipeline) (sharing Pipeline._init_pixel_context()) and mesh_plain_params handling in tools/startup/gfx2hlsl.py to translate paired pixel shaders (linear, flat v_interp_mov_f32 p0, plain-32-bit v_interp_p1ll_f16/v_interp_p2_f16, and depth-only stages) and validate attribute coverage against the mesh exports.
  • Add tests/mesh_param_link_check.py, register mesh_param_link_{controls,warp,hardware} in CMakeLists.txt, and wire tests/mesh_param_link_check.py into pixel-binary (llvm-mc-15) and python-linux in .github/workflows/windows.yml.

Refs #2413, #1998

Verification

  • Base commit: 7092683a (upstream/main)
  • Branch commit: 8f995344 (feat/mesh-param12-linkage)
  • Host environment: Windows 11 x64 (26300.9974), DXC 1.9.2602.17
  • WARP: Microsoft Basic Render Driver (1414:008c), driver 10.0.26100.9818, D3D12 debug layer enabled
  • Hardware GPU: NVIDIA GeForce RTX 5080 (10de:2c02), driver 32.0.16.2124, D3D12 debug layer enabled

Commands and Observed Results

.\out\pe-env\Scripts\python.exe -B tests/mesh_param_link_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_clip_cull_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_dynamic_geometry_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_dynamic_aot_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_heap_sampler_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_lane_spill_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_join_descriptor_check.py
.\out\pe-env\Scripts\python.exe -B tests/mesh_loop_census_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_interp_f16_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_translator_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_tools_lint_check.py
.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py
.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py
git diff --check upstream/main...HEAD
ctest --preset dev --no-tests=error -j 1 -R '^(mesh_param_link_|mesh_attribute_draw_|mesh_clip_cull_controls|startup_tools_lint$)' -V
ctest --preset release --no-tests=error -j 1 -R '^mesh_param_link_' -V
  • Observed: all Python/neighbor/lint/docs/bidi checks passed (docs_links_check.py: 19 files / 464 links; bidi_controls_check.py: 1723 files; git diff --check: clean).
  • On-disk self-mutation test (MAX_PARAM = 12 -> 15 in tools/mesh_param_link.py): caught (rc=1) and reverted cleanly.
  • dev: 6 passed, 0 skipped, 0 failed (startup_tools_lint 0.15 s, mesh_param_link_controls 0.44 s, mesh_attribute_draw_hardware 2.37 s, mesh_param_link_hardware 2.71 s, mesh_attribute_draw_warp 0.87 s, mesh_param_link_warp 1.11 s; debug_errors=0 debug_warnings=0, all 5 ms_6_5+ps_6_0 draws pixels=1024 mismatches=0, both GPU negative controls caught at 992 and 1024 mismatched pixels).
  • release: 3 passed, 0 skipped, 0 failed (controls 0.44 s, hardware 2.31 s, warp 1.10 s; debug_errors=0 debug_warnings=0).
  • Note: tests/mesh_param_link_check.py binary llvm-mc-15 was not run locally (llvm-mc is not installed on this Windows host) and is wired into the Ubuntu pixel-binary CI job.
  • Scope note: these passing fixtures verify param0..param12 export and MeshPixelStage pixel pairing in isolation; they do not establish full-game startup or slot-57 runtime DispatchMesh forwarding.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6608887077 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2427). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-25T16:26:50Z. --- ## Summary - Implement #2413 Item T4 (*Parameter exports up to `param12` and their pairing with the pixel stage inputs*) across the bounded mesh translators and `gfx2hlsl.py`. - Add `tools/mesh_param_link.py` (`MAX_PARAM = 12` per AMD RDNA 2 ISA §10.2 `EXP` target `32 + N`, `MAX_VERTEX_VECTORS = 32` per D3D12 SM 6.5 vertex output limit) with `ParamLinkage`, `validate_linkage`, `merge_wave_params`, `hlsl_param_fields`, and `hlsl_param_writes` (dense `PARAM0..PARAM12`, `nointerpolation uint4 FPARAM*`, `HPARAML*`/`HPARAMH*` binary16 halves, and zero-initialized unexported gap slots), preserving legacy `TEXCOORD0` for `param0`-only callers without an explicit `ParamLinkage`. - Extend `tools/mesh_entry_aot.py` and `tools/mesh_dynamic_aot.py` to decode and validate `exp param0`..`exp param12` across waves and dynamic variants (keeping CLI `__main__` untouched to avoid overlap with #2394/#2407). - Add `MeshPixelStage(Pipeline)` (sharing `Pipeline._init_pixel_context()`) and `mesh_plain_params` handling in `tools/startup/gfx2hlsl.py` to translate paired pixel shaders (linear, flat `v_interp_mov_f32 p0`, plain-32-bit `v_interp_p1ll_f16`/`v_interp_p2_f16`, and depth-only stages) and validate attribute coverage against the mesh exports. - Add `tests/mesh_param_link_check.py`, register `mesh_param_link_{controls,warp,hardware}` in `CMakeLists.txt`, and wire `tests/mesh_param_link_check.py` into `pixel-binary` (`llvm-mc-15`) and `python-linux` in `.github/workflows/windows.yml`. Refs #2413, #1998 ## Verification - **Base commit:** `7092683a` (`upstream/main`) - **Branch commit:** `8f995344` (`feat/mesh-param12-linkage`) - **Host environment:** Windows 11 x64 (`26300.9974`), DXC `1.9.2602.17` - **WARP:** `Microsoft Basic Render Driver` (`1414:008c`), driver `10.0.26100.9818`, D3D12 debug layer enabled - **Hardware GPU:** `NVIDIA GeForce RTX 5080` (`10de:2c02`), driver `32.0.16.2124`, D3D12 debug layer enabled ### Commands and Observed Results ```powershell .\out\pe-env\Scripts\python.exe -B tests/mesh_param_link_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_clip_cull_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_dynamic_geometry_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_dynamic_aot_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_heap_sampler_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_lane_spill_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_join_descriptor_check.py .\out\pe-env\Scripts\python.exe -B tests/mesh_loop_census_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_interp_f16_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_translator_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_tools_lint_check.py .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py git diff --check upstream/main...HEAD ctest --preset dev --no-tests=error -j 1 -R '^(mesh_param_link_|mesh_attribute_draw_|mesh_clip_cull_controls|startup_tools_lint$)' -V ctest --preset release --no-tests=error -j 1 -R '^mesh_param_link_' -V ``` - Observed: all Python/neighbor/lint/docs/bidi checks passed (`docs_links_check.py`: 19 files / 464 links; `bidi_controls_check.py`: 1723 files; `git diff --check`: clean). - On-disk self-mutation test (`MAX_PARAM = 12` -> `15` in `tools/mesh_param_link.py`): caught (`rc=1`) and reverted cleanly. - `dev`: **6 passed, 0 skipped, 0 failed** (`startup_tools_lint` 0.15 s, `mesh_param_link_controls` 0.44 s, `mesh_attribute_draw_hardware` 2.37 s, `mesh_param_link_hardware` 2.71 s, `mesh_attribute_draw_warp` 0.87 s, `mesh_param_link_warp` 1.11 s; `debug_errors=0 debug_warnings=0`, all 5 `ms_6_5`+`ps_6_0` draws `pixels=1024 mismatches=0`, both GPU negative controls caught at 992 and 1024 mismatched pixels). - `release`: **3 passed, 0 skipped, 0 failed** (`controls` 0.44 s, `hardware` 2.31 s, `warp` 1.10 s; `debug_errors=0 debug_warnings=0`). - Note: `tests/mesh_param_link_check.py binary llvm-mc-15` was not run locally (`llvm-mc` is not installed on this Windows host) and is wired into the Ubuntu `pixel-binary` CI job. - Scope note: these passing fixtures verify `param0`..`param12` export and `MeshPixelStage` pixel pairing in isolation; they do not establish full-game startup or slot-57 runtime `DispatchMesh` forwarding.
tedin7 commented 2026-11-25 20:04:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:24:10Z.

Review: COMMENTED


Review of head 8f995344 (comment only).

Result: code looks sound. Not merged by us yet because the branch is 60 commits behind main (limit 20).

Checked:

  • tools/mesh_param_link.py: slot range 0..12, flat and binary16 slots must be exported, 32-vector limit, per-wave merge requires every slot to cover every vertex. Legacy TEXCOORD0 path for param0-only callers is kept.
  • gfx2hlsl.py: _init_pixel_context split keeps the Pipeline.__init__ behaviour. MeshPixelStage rejects pixel reads of attributes the mesh stage does not export, and binary16 reads of non-plain slots.
  • CI on this head: Linux Python checks, gfx1013 fixtures and Windows build all green. The author's Windows run is on this head.
  • Sibling tables: the windows.yml additions wire the new check into pixel-binary and python-linux. No other open or merged PR covers this slice (search "param12 mesh").

Commands run locally on this head:

  • python3 tests/mesh_param_link_check.py -> passed
  • python3 tests/docs_links_check.py -> passed
  • python3 tests/bidi_controls_check.py -> passed
  • git diff --check origin/main...HEAD -> clean
  • Mutation 1: MAX_PARAM = 13 -> the test fails (range control).
  • Mutation 2: disable the "Incomplete vertex parameter" check -> the test fails (KeyError).

Not verified here: the D3D12 WARP draw readback (mesh_param_link_warp / _hardware) only runs on Windows. We did not run it on this head.

Next step for the author: merge or update the branch with main (60 behind), then re-check CI. After that a merger can run Win2025 dev+release on the new head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6063657715 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2427#pullrequestreview-6063657715). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T19:24:10Z. **Review:** COMMENTED --- Review of head 8f995344 (comment only). Result: code looks sound. Not merged by us yet because the branch is 60 commits behind main (limit 20). Checked: - `tools/mesh_param_link.py`: slot range 0..12, flat and binary16 slots must be exported, 32-vector limit, per-wave merge requires every slot to cover every vertex. Legacy `TEXCOORD0` path for param0-only callers is kept. - `gfx2hlsl.py`: `_init_pixel_context` split keeps the `Pipeline.__init__` behaviour. `MeshPixelStage` rejects pixel reads of attributes the mesh stage does not export, and binary16 reads of non-plain slots. - CI on this head: Linux Python checks, gfx1013 fixtures and Windows build all green. The author's Windows run is on this head. - Sibling tables: the `windows.yml` additions wire the new check into `pixel-binary` and `python-linux`. No other open or merged PR covers this slice (search "param12 mesh"). Commands run locally on this head: - `python3 tests/mesh_param_link_check.py` -> passed - `python3 tests/docs_links_check.py` -> passed - `python3 tests/bidi_controls_check.py` -> passed - `git diff --check origin/main...HEAD` -> clean - Mutation 1: `MAX_PARAM = 13` -> the test fails (range control). - Mutation 2: disable the "Incomplete vertex parameter" check -> the test fails (KeyError). Not verified here: the D3D12 WARP draw readback (`mesh_param_link_warp` / `_hardware`) only runs on Windows. We did not run it on this head. Next step for the author: merge or update the branch with main (60 behind), then re-check CI. After that a merger can run Win2025 dev+release on the new head. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 08:01:40 +00:00
R0Y00 commented 2026-11-26 08:01:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T07:14:12Z.

Review: APPROVED


Reconciled the shared initialization with current main, including descriptor-write state and the separate main MeshPipeline. The original checks are registered through the current CTest and Linux fragments. Windows Release passed 11 of 11 with no skips, including param0 through param12 draw and negative controls on WARP and RTX 4060 Laptop, plus the existing clip/cull, dynamic mesh, entry and vertex-fetch cases.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069911049 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2427#pullrequestreview-6069911049). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T07:14:12Z. **Review:** APPROVED --- Reconciled the shared initialization with current main, including descriptor-write state and the separate main MeshPipeline. The original checks are registered through the current CTest and Linux fragments. Windows Release passed 11 of 11 with no skips, including param0 through param12 draw and negative controls on WARP and RTX 4060 Laptop, plus the existing clip/cull, dynamic mesh, entry and vertex-fetch cases.
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!2419
No description provided.