Skip to content

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

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
lambirou:shader/psi1-interfaces
Nov 30, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
lambirou:shader/psi1-interfaces

Conversation

@lambirou

@lambirou lambirou commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

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 a7374bd (run 46337559646): Windows pass (3m08s), Linux Python checks pass (3m04s), gfx1013 fixture assembly pass (2m50s); Release /O2 skipping by PR configuration.

@lukaslw-lab lukaslw-lab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@R0Y00
R0Y00 merged commit 945ce20 into R0Y00:main Nov 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: P0 Highest project priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants