shader: derive fixed slot 57 interfaces from PSI1 entries #3532

Merged
lambirou merged 1 commit from upstream-pr/3532 into main 2026-11-30 08:42:22 +00:00
lambirou commented 2026-11-30 01:53:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-30T01:53:45Z.


Problem

A fixed slot 57 pixel entry (PSI1 + SPI_PS_INPUT_ADDR + SPI_PS_IN_CONTROL) can arrive without a reviewed .cdxil sidecar. prepare_direct_graphics treated any PSI1 entry without reflected stage interfaces as unsupported and threw fixed graphics entry requires matching stage interfaces, so a valid fixed VS/PS pair never reached the raw frontend.

Change

  • When a PSI1 entry has no reflected companions, derive the two pixel-stage interfaces from the captured record: accept only address 2 or 0x8002, with 1 to 7 interpolants, and build the psin1 record the reflected path would hand to the raw frontend.
  • Track the packed-XY address and captured interpolant count. After linking, refuse any raw TEXCOORD row beyond the captured count; position and barycentric inputs keep their existing handling.
  • Keep the reflected channel reconciliation unchanged; it only runs when companions are present.
  • Add native_fixed_graphics_psi1, a source-built fixture covering center and packed position, cache reuse, bad address/control masks, over-counted interpolation, and an unallocated packed-position VGPR.

Refs #3385 (the no-sidecar branch of the PSI1 refusal; #3410 covered the .ps57in fallback).

Tests

Windows x64, Release /O2, MSVC 19.44.35228.0, Windows SDK 10.0.26100.0, DXC 10.0.26100.0.

python -m venv out/pe-env
.\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt
. .\tools\dev.ps1
cmake --preset release
cmake --build --preset release --target compile_dxil
ctest --preset release --no-tests=error -R '^native_fixed_graphics_psi1$' -V
ctest --preset release --no-tests=error -R '^(native_graphics_interface_library|native_direct_container)$' -V

Results:

  • native_fixed_graphics_psi1: 1/1 passed (0.64 s).
  • native_graphics_interface_library and native_direct_container: 2/2 passed (1.05 s and 29.04 s).
  • WARP: not applicable. native_fixed_graphics_psi1 invokes compile_dxil only and has no adapter parameter; it does not create a D3D12 device.
  • Hardware: not applicable for the same reason. No GPU submission is claimed.

AI-assisted.
CI on a7374bd0 (run 46337559646): Windows pass (3m08s), Linux Python checks pass (3m04s), gfx1013 fixture assembly pass (2m50s); Release /O2 skipping by PR configuration.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5557575605 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3532). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-30T01:53:45Z. --- ## Problem A fixed slot 57 pixel entry (`PSI1` + `SPI_PS_INPUT_ADDR` + `SPI_PS_IN_CONTROL`) can arrive without a reviewed `.cdxil` sidecar. `prepare_direct_graphics` treated any PSI1 entry without reflected stage interfaces as unsupported and threw `fixed graphics entry requires matching stage interfaces`, so a valid fixed VS/PS pair never reached the raw frontend. ## Change - When a PSI1 entry has no reflected companions, derive the two pixel-stage interfaces from the captured record: accept only address `2` or `0x8002`, with 1 to 7 interpolants, and build the `psin1` record the reflected path would hand to the raw frontend. - Track the packed-XY address and captured interpolant count. After linking, refuse any raw TEXCOORD row beyond the captured count; position and barycentric inputs keep their existing handling. - Keep the reflected channel reconciliation unchanged; it only runs when companions are present. - Add `native_fixed_graphics_psi1`, a source-built fixture covering center and packed position, cache reuse, bad address/control masks, over-counted interpolation, and an unallocated packed-position VGPR. Refs #3385 (the no-sidecar branch of the PSI1 refusal; #3410 covered the `.ps57in` fallback). ## Tests Windows x64, Release /O2, MSVC 19.44.35228.0, Windows SDK 10.0.26100.0, DXC 10.0.26100.0. ```powershell python -m venv out/pe-env .\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt . .\tools\dev.ps1 cmake --preset release cmake --build --preset release --target compile_dxil ctest --preset release --no-tests=error -R '^native_fixed_graphics_psi1$' -V ctest --preset release --no-tests=error -R '^(native_graphics_interface_library|native_direct_container)$' -V ``` Results: - `native_fixed_graphics_psi1`: 1/1 passed (0.64 s). - `native_graphics_interface_library` and `native_direct_container`: 2/2 passed (1.05 s and 29.04 s). - WARP: not applicable. `native_fixed_graphics_psi1` invokes `compile_dxil` only and has no adapter parameter; it does not create a D3D12 device. - Hardware: not applicable for the same reason. No GPU submission is claimed. AI-assisted. CI on a7374bd0 (run 46337559646): Windows pass (3m08s), Linux Python checks pass (3m04s), gfx1013 fixture assembly pass (2m50s); Release /O2 skipping by PR configuration.
lukaslw-lab commented 2026-11-30 07:21:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T07:21:04Z.

Review: APPROVED


Reviewed a7374bd0 by reading the diff; not built or run.

Verdict: approve. The no-sidecar branch admits only the two address forms the reflected path already accepts (2, 0x8002) and 1–7 interpolants. The raw frontend still checks every VGPR use, and the post-link check refuses TEXCOORD rows beyond the captured count. No MUST.

  • SHOULD tighten the packed-position assertion (tests/native_fixed_graphics_psi1_check.py:82): "SV_Position" in dump or "loadInput" in dump also passes for a PS that reads only TEXCOORD, so it does not prove that 0x8002 reached the packed XY input. Assert SV_Position alone.
  • SHOULD note the overlap with #3527. Both edit the PSI1 block of prepare_direct_graphics, and git merge-tree of the two heads conflicts in src/direct_compute_cache.cpp. Whichever merges second needs a rebase. The two branches are disjoint (!reflected here, the reflected zero-count case there), so the resolution should be mechanical.
  • NIT r.kind == 28 (src/direct_compute_cache.cpp:793): a named constant or a short comment (barycentrics) would help. The reflected loop below also requires interpolation == 2 for it, but the new loop skips any kind-28 input.
  • Checked: the reflected path is unchanged; the entry/pixel_entry handoff matches the reflected psin1 record; the channel reconciliation now runs only with companions (:799).
  • Scope: this does not cover issue #3560 (ADDR 0x8080, NUM_INTERP 0). That entry has an interface sidecar in our catalog caches, so it stays on the reflected path, and without one it would now be refused as "unsupported fixed pixel entry layout". The behaviour stays the same; the PR is still correct for its own case.

Tests: native_fixed_graphics_psi1 reaches the new branch with positive cases (centre, cache hit, packed) and negative controls for each new refusal: address, control, over-count, and the unallocated packed VGPR (the raw frontend's own check). It is not in the pr preset filter and needs DXC, so CI did not run it. The author's local Release run is the only evidence so far.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6108219815 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3532#pullrequestreview-6108219815). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-30T07:21:04Z. **Review:** APPROVED --- Reviewed `a7374bd0` by reading the diff; not built or run. **Verdict: approve.** The no-sidecar branch admits only the two address forms the reflected path already accepts (2, 0x8002) and 1–7 interpolants. The raw frontend still checks every VGPR use, and the post-link check refuses TEXCOORD rows beyond the captured count. No MUST. - **SHOULD** tighten the packed-position assertion (`tests/native_fixed_graphics_psi1_check.py:82`): `"SV_Position" in dump or "loadInput" in dump` also passes for a PS that reads only TEXCOORD, so it does not prove that 0x8002 reached the packed XY input. Assert `SV_Position` alone. - **SHOULD** note the overlap with #3527. Both edit the PSI1 block of `prepare_direct_graphics`, and `git merge-tree` of the two heads conflicts in `src/direct_compute_cache.cpp`. Whichever merges second needs a rebase. The two branches are disjoint (`!reflected` here, the reflected zero-count case there), so the resolution should be mechanical. - **NIT** `r.kind == 28` (`src/direct_compute_cache.cpp:793`): a named constant or a short comment (barycentrics) would help. The reflected loop below also requires `interpolation == 2` for it, but the new loop skips any kind-28 input. - Checked: the reflected path is unchanged; the `entry`/`pixel_entry` handoff matches the reflected `psin1` record; the channel reconciliation now runs only with companions (`:799`). - Scope: this does not cover issue #3560 (ADDR 0x8080, NUM_INTERP 0). That entry has an interface sidecar in our catalog caches, so it stays on the reflected path, and without one it would now be refused as "unsupported fixed pixel entry layout". The behaviour stays the same; the PR is still correct for its own case. Tests: `native_fixed_graphics_psi1` reaches the new branch with positive cases (centre, cache hit, packed) and negative controls for each new refusal: address, control, over-count, and the unallocated packed VGPR (the raw frontend's own check). It is not in the `pr` preset filter and needs DXC, so CI did not run it. The author's local Release run is the only evidence so far.
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!3532
No description provided.