startup: link stream pixel attributes to vertex parameters by semantic #2136
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2144"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T01:31:27Z.
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
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:40:44Z.
Review: COMMENTED
Review of head
5b1fe802441009b35a74d980983b43c28bbf6830(comment only, no approval).Scope:
stream_interface()intools/startup/gfx2hlsl.pylinks 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 tox2w-startup-shader-8. New testtests/startup_stream_interface_check.pyis 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.mapping[attr] = params[...]changed tomapping[attr] = attr. The interface test fails on theparam1assertion. Killed.output[1] != maskreplaced byFalse. The "different components" case fails. Killed.git checkout -- .after each mutation.Findings:
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.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.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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T01:56:10Z.
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.