Repository navigation
startup: link stream pixel attributes to vertex parameters by semantic - #2144
Conversation
A slot-86 pixel shader's attribute N is not vertex parameter N. Both
containers state their side of the interface in the native header: the vertex
shader one 6-byte record per exported parameter from +0x1dc (count at +0x29c),
the pixel shader one 8-byte record per attribute from +0x138 (count at
+0x238). gfx2hlsl links each attribute to the vertex parameter whose output
register carries the same semantics with the same components, and refuses
packed records, unmatched semantics, a pixel header of another size and reads
of attributes the table does not list. Raw programs without signatures still
pair by number. The shader cache revision moves to x2w-startup-shader-6.
startup_stream_interface_translate (also in the Linux job) checks the link and
each refusal without a device; startup_stream_interface_{warp,hardware} draws a
TEXCOORD gradient that pairing by number fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… inputs Stream fixtures whose pixel shader declares no inputs keep translating; a read of an attribute is then refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Takes upstream's request loading (load_request, request_refusals) and threads the interface map through it and both Pipeline sites; the cache revision moves past upstream's shader-6 to shader-7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he interface map Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Linking pixel attributes by semantic changes container translations; main already uses shader-7, so the revision moves past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Refuse a pixel record whose mask differs from the input signature's mask for its register, and a pixel table that lists one register twice. - Translator-only cases for the semantic index (TEXCOORD1), two vertex sources for one attribute, a duplicate pixel register, a vertex header of another size, a pixel count of 0 and a pixel container without an input signature. - load_request always returns seven items; the translator check's mock uses that shape. - Remove a duplicated table the earlier merge copied; order the CMake entries; state the archive counts with their populations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps upstream's new pure-Python list entries next to the interface check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedin7
left a comment
There was a problem hiding this comment.
Review of head 5b1fe802441009b35a74d980983b43c28bbf6830 (comment only, no approval).
Scope: stream_interface() in tools/startup/gfx2hlsl.py links pixel attributes to vertex parameters by semantic (name + index + component mask) through both containers' interface tables. It refuses anything unverified. The cache revision is bumped to x2w-startup-shader-8. New test tests/startup_stream_interface_check.py is wired into CMake for translate and for each backend.
Checks run locally in a worktree of this head:
gh pr checks 2144: Linux Python checks, gfx1013 fixtures, Windows build and test all pass. The /O2 job is skipped and the chart publish is skipped.python3 -B tests/startup_stream_interface_check.py: all cases pass (semantic index link, TEXCOORD parameter reorder, packed pixel record refused, packed vertex record refused, header size refused, mask mismatch refused, two vertex sources refused, duplicate pixel register refused, count 0, no pixel signature).python3 -B tests/startup_translator_check.py: 0 failed.python3 tests/docs_links_check.py: pass (18 files, 398 links).python3 tests/bidi_controls_check.py: pass.git diff --check origin/main...HEAD: clean.- Mutation 1:
mapping[attr] = params[...]changed tomapping[attr] = attr. The interface test fails on theparam1assertion. Killed. - Mutation 2: the component mask comparison
output[1] != maskreplaced byFalse. The "different components" case fails. Killed. - Worktree restored with
git checkout -- .after each mutation.
Findings:
- P1: none.
- P2: none.
- nit (
tools/startup/gfx2hlsl.py,stream_interface): the same 8-byte and 6-byte record slice is written twice, once to unpack and once for the error message. Binding it to a local would be shorter. - nit:
stream_interfaceis about 55 lines. Splitting the pixel-record loop and the vertex-record loop into helpers would match the file's usual function size. - nit: this PR changes translator output for stream pairs, so the Windows D3D12 WARP stream draw tests (
startup_stream_interface_<backend>) are the real proof of the behavior. They ran green in the Windows CI job. I did not run a separate Win2025 pipeline job. The CI result was enough for a refusal-heavy table change.
Clean-room and title: the title is neutral and there are no vendor or game names in the diff. mergeable is UNKNOWN at review time. The head is a merge of main, so the CI above covers the merged state.
AI-assisted; commands listed were executed locally.
|
I kept the semantic-linking path and added refusals for an undeclared component read, duplicate vertex output semantics and interface tables that exceed their header regions. Local Windows Release passed the translation, WARP and RTX 4060 Laptop cases (3/3, no skips), including the wrong-by-number GPU control. The startup translator regression also passes. |
Change
In a slot-86 stream pipeline the pixel shader's attribute N is not vertex parameter N. Until now
gfx2hlsl.pypaired them by number. A pixel shader that reads only some of the vertex outputs could then interpolate the wrong
one, for example a constant colour where it expects a texture coordinate.
Each container states its side of the interface in its native header:
count is at +0x29c.
interpolation); the count is at +0x238.
gfx2hlsl.pynow links each attribute to the vertex parameter whose output register carries the same semantics, withthe same semantic index and the same components. It refuses, with a reason:
signature;
Raw programs without signatures keep pairing by number. A pixel shader that declares no inputs reads no tables.
draw_translatedis unchanged. The shader cache revision moves tox2w-startup-shader-8on both the offline andruntime sides, so translations paired by number are not reused.
Refs #1142. AI-assisted (Claude Code).
Verification
Head
5b1fe802(merged withmainat097f7539).python -B tests/startup_stream_interface_check.py, alsostartup_stream_interface_translateandthe Linux job. Attribute 0 links to the TEXCOORD parameter, including by semantic index (TEXCOORD1). It also checks
13 refusals: packed pixel record, packed vertex record, different components, semantic not output, pixel header
size, vertex header size, attribute beyond the table, record mask, two vertex sources, duplicate pixel register,
pixel count 0, no pixel signature.
ctest --preset release --no-tests=error -R '^startup_stream_interface_(warp|hardware)$' -V.pixel shader reads only TEXCOORD, as attribute 0.
RTX 5090.
index, pixel count not read, first of several vertex sources, no inputs paired by number, vertex header check
skipped, no duplicate-register check, record mask not compared.
ctest --preset release --no-tests=error -R '^startup_stream_' -j1and the startup checks inthe pure-Python list pass.
Evidence and follow-up
The record layouts were checked offline against the signatures of one local shader archive (local files, not in
the repository; counts only, using the translator's own record checks):
A pipeline that needs packed records is now refused.
records. These are refused instead of being paired by number. The 1,239 without inputs need no table.
four-component output that feeds a two-component input.
depth-test state without a depth format (a separate change).
calibration panel that was flat background before is now drawn: a dark panel with its symbol. Every other checked
screen is pixel-identical. Before the change, a capture showed that pipeline's pixel shader interpolating COLOR (the
constant (1, 1, 1, 1)) as its texture coordinate, so it wrote the background level everywhere.
Checklist
🤖 Generated with Claude Code