shader: lower unsigned RGBA8 vertex fetches #2185
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2193"
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 RavenCurseBurg on 2026-11-25T03:45:37Z.
Refs #2023, item G (claim).
The startup translator now reads gfx10 format 60 as four unsigned bytes in increasing address order. The same decoder handles DXGI
R8G8B8A8_UINT(30) in stream input layouts. The unaligned load is shared with the existing RGBA8 UNORM path. LLVM 15 lists the format as four 8-bit fields with unsigned integer interpretation. LLVM format table · DXGI format enumerationVerification
Current head
c1b5d3f8includes the upstream MSVC build fix from #2204. The stream-fetch controls and WARP readback passed again locally: 13 formats, 16 vertices each, all 12 shader mutations detected. The upstream Windows build, Linux checks, and gfx1013 assembly checks passed. Upstream CI · Full Windows 2025 Debug and Release runAt
a28a2b1e, I reranpython -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warpon Windows. All 13 formats passed at 16 vertices each. RGBA8 UINT matched all 64 component words and the untouched tail. The readback rejected all 12 shader mutations, including blue from green and alpha from blue. Replacing the translator's alpha expression with the blue expression also failed the device-freecontrols()check. Latest test reportOn base
b80be156, the source-built MTBUF instruction was refused withbuffer format BUF_FMT_8_8_8_8_UINT. One375e5c5, the fixture reads all four channels of 16 vertices at stride 5, offset 3, covering all four dword alignments. A shader that normalizes the green byte fails the readback. The independent byte reference also detects swapped channels and a one-byte shift.python -B tests/startup_vertex_fetch_formats_check.py controlsandpython -B tests/startup_stream_fetch_check.pypassed, including the DXGI stream layout and its three-component fetch record.python -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warppassed for all 13 formats. The new format matched all 320 checked words (64 component words plus the untouched tail). All applicable wrong references and all 10 shader mutations were detected. Used DXC v1.9.2609 and the upstream offscreen_check build at 153bb5f6.python -B tools/run_checks_parallel.py -j 4 $checkspassed all 43 scripts. In PowerShell,$checks = (Get-ChildItem tests/startup_gfx2hlsl_*_check.py).FullName + @('tests/startup_translator_check.py').python -B tests/docs_links_check.pychecked 405 links.python -B tests/bidi_controls_check.pychecked 1,479 files.git diff HEAD^ --checkpassed.The fixture extends the project's hand-assembled vertex program and its existing deterministic input buffer. Reproduction in the experiment guide
AI-assisted with Codex (GPT-6.2 Astra xhigh, as specified by the contributor).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:53:56Z.
Review: COMMENTED
Review at head
e375e5c5777fcc0e224257e9a446644f1dd80897. 0 P1, 0 P2.Logic: DXGI 30 is
R8G8B8A8_UINT; gfx10 buffer format 60 is8_8_8_8_UINT. Four unsigned bytes go to X, Y, Z, W in address order with no normalization, andldu()handles the unaligned dword cases. Sibling tablesFETCH_DXGIandFETCH_FORMATSare both extended. No other open or recently merged PR covers this format.Tests: the existing WARP readback suite
startup_vertex_fetch_formatsgets a new8_8_8_8_UINTentry (stride 5, offset 3) with a GPU-readback vs CPU-reference comparison, plus a new mutation control.startup_stream_fetch_translategets a new DXGI 30 case.Verification (Linux):
python3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleanpython3 tests/startup_vertex_fetch_formats_check.py controls: passpython3 tests/startup_stream_fetch_check.py: pass8_8_8_8_UINTrow.startup_stream_fetch_check.pyfails (rc=1).8_8_8_8_UNORM.startup_stream_fetch_check.pyfails (rc=1).Verification (Windows Server 2025, WARP, no build fast-path):
x2w_pipe.py win2025 2193 --scope direct --targets offscreen_check --regex 'startup_vertex_fetch_formats|startup_stream_fetch' --no-skip-buildstartup_vertex_fetch_formats_{warp,hardware,controls}andstartup_stream_fetch_{warp,hardware,translate}all pass.startup_vertex_fetch_formats_*pass.startup_stream_fetch_{warp,hardware}failed once withrequest key does not include the layout, an assertion this PR does not touch.--regex 'startup_stream_fetch': 3/3 pass in Debug and 3/3 pass in Release /O2. The first failure looks like a flake from the parallel run, but I did not find its cause.Notes (non-blocking):
docs/experiments.mdrewrite of the "ten formats" paragraph drops the pointer to the16_16_SNORMsection that follows. Please keep that reference.Windows checksrun isaction_required(it needs maintainer approval), so theBuild and test on Windowscheck has not run. It must be SUCCESS before merge.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:59:39Z.
Review: COMMENTED
Re-review of head
0f506b562778141bc6b7763b675617019be8cbff(previous review coverede375e5c5; the only change since is a docs wording fix indocs/experiments.md).Verdict: no P1, no P2.
What I checked
tools/startup/gfx2hlsl.py: format 60 (BUF_FMT_8_8_8_8_UINT, matches the gfx10 numbering intools/disasm_rdna2.py:1293) is added toFETCH_FORMATSwith the sameldu()unaligned load as the UNORM sibling and raw byte extractionw & 255u,(w >> 8) & 255u,(w >> 16) & 255u,w >> 24. The sibling tableFETCH_DXGIgets DXGI 30 (R8G8B8A8_UINT), next to 28 (R8G8B8A8_UNORM). Byte order and unsigned semantics are correct.startup_vertex_fetch_formats_check.pyFORMATS and MUTATIONS,startup_stream_fetch_check.pyDXGI layout) instead of adding a new file. Stride 5 / offset 3 covers all four dword alignments.Commands run locally on the head (Linux):
python3 -B tests/startup_vertex_fetch_formats_check.py controls->vertex fetch format controls passedpython3 -B tests/startup_stream_fetch_check.py-> passed (includes the new DXGI 30 record)python3 tests/docs_links_check.py->Checked 18 Markdown files and 405 links.python3 tests/bidi_controls_check.py-> no bidirectional controlsgit diff --check origin/main...HEAD-> clean(w >> 8)to(w >> 16)ingfx2hlsl.py. Bothstartup_vertex_fetch_formats_check.py controlsandstartup_stream_fetch_check.pyfailed (AssertionError), so the tests kill a channel swap. Reverted withgit checkout -- ..Not run: the D3D12 WARP readback (
startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warp). I did not queue the Windows VM; the PR body reports it passed on the earlier head, and the delta since then is docs only.Nits
16_16_SNORM,16_16_16_16_FLOATand8_8_8_8_UINTto the list so it is complete.Process note for the maintainer: no CI checks are reported on this head. The Windows CI run needs maintainer approval before it starts.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T03:57:07Z.
Restored the pointer to the
16_16_SNORMsigned endpoint and negative-control checks in0f506b56. The docs link check (405 links), bidi check and vertex-fetch format controls passed on this head. Thanks for recording both the initial Release failure and the isolated rerun.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:09:07Z.
Review: COMMENTED
Re-review of head
5405e67b9b440f754f2d0c7cf24dc73b3bad594d(3 commits over main; 4 files, +17/-5 in the latest diff stat).Scope read:
FETCH_DXGI30 ->BUF_FMT_8_8_8_8_UINT(stride 4), theFETCH_FORMATSentry (ldu,w & 255u,(w >> 8) & 255u,(w >> 16) & 255u,w >> 24), the new translate case intests/startup_stream_fetch_check.py, the new format and mutation intests/startup_vertex_fetch_formats_check.py, and thedocs/experiments.mdwording.Commands executed locally (Linux):
python3 tests/startup_stream_fetch_check.py-> passes (new R8G8B8A8_UINT translate case included).python3 tests/startup_vertex_fetch_formats_check.py controls->vertex fetch format controls passed.python3 tests/docs_links_check.py-> self-test passed, 18 files / 405 links.python3 tests/bidi_controls_check.py-> no bidirectional controls in 1479 files.git diff --check origin/main...HEAD-> clean.(w >> 16) & 255uto(w >> 8) & 255uinFETCH_FORMATS->startup_stream_fetch_check.pyfails (rc=1), so the test kills it. Reverted.Findings
MUTATIONSlist for the device run covers only the green byte for this format. Optional: add a mutation for Z or W.x2w_pipe.py win2025; the device run belongs to the Windows gate.Status: mergeable, title neutral, no clean-room concerns seen in the diff. No CI checks are reported on the branch. The Linux-side logic looks correct.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:23:30Z.
Review: COMMENTED
Re-review of head
fa528dc03c1c7b63d0d5d2469382c52aab7c2a10(shader: lower unsigned RGBA8 vertex fetches). Comment-only review.Scope: 4 files, +18/-5:
tools/startup/gfx2hlsl.py(FETCH_DXGI 30 ->BUF_FMT_8_8_8_8_UINT, one FETCH_FORMATS row),tests/startup_vertex_fetch_formats_check.py,tests/startup_stream_fetch_check.py,docs/experiments.md.Correctness
R8G8B8A8_UINT; gfx10 buffer format 60 =8_8_8_8_UINT. Both match the siblings (28/56for UNORM). Size 4 is right.ldu({0}, a)plusw & 255u,(w >> 8) & 255u,(w >> 16) & 255u,w >> 24: little-endian, unsigned, raw integers with no normalization.w >> 24onuintneeds no mask. Unaligned element is handled byldu(), as for UNORM.FETCH_DXGInext toFETCH_FORMATS, the tbuffer format table, the formats fixture, the stream-fetch translate case). No gap found.Commands executed locally (all in the review worktree)
python3 tests/startup_vertex_fetch_formats_check.py controls->vertex fetch format controls passedpython3 -B tests/startup_stream_fetch_check.py(translate cases, includes the new rgba8_uint case) -> passedpython3 tests/docs_links_check.py->Checked 18 Markdown files and 405 links.python3 tests/bidi_controls_check.py->no bidirectional controlsgit diff --check origin/main...HEAD-> cleangh pr checks-> no checks reported on the branch. PR is MERGEABLE.Mutations
blue byte from greenmutation).w >> 24tow >> 16: survives both Linux checks. Expected, since the translate case uses an XYZ record and the controls do not evaluate the new row. Only the D3D12 readback (startup_vertex_fetch_formats_warp/_hardware) can kill it.Findings
w >> 24line to the translate case with a 4-component record, or a W mutation inMUTATIONS, so a W regression also fails without a device.startup_vertex_fetch_formats_warpshould confirm it before Ready.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T04:47:02Z.
Review: COMMENTED
Re-review of head
a28a2b1e21.Scope: 4 files, +19/-5. Adds
BUF_FMT_8_8_8_8_UINT(gfx10 format 60) toFETCH_FORMATSand DXGI 30 (R8G8B8A8_UINT) toFETCH_DXGIintools/startup/gfx2hlsl.py:105,110, plus tests and a docs note.Findings: P1=0, P2=0.
tools/disasm_rdna2.py:1293table; DXGI 30 is R8G8B8A8_UINT. The four bytes load in address order throughldu, as the unaligned UNORM sibling does. Components stay rawuintwith no float conversion, and no default-component assumption is needed because all four fields exist.startup_stream_fetch_check.pychecks the three byte extractions and thev7 = w >> 24alpha path. Thestartup_vertex_fetch_formats_check.pytable gains a UINT entry plus three mutations: normalized green, blue read from green, alpha read from blue.Commands executed locally in the worktree:
git diff --stat origin/main...HEAD: 4 files, 19 insertions, 5 deletions.python3 tests/startup_vertex_fetch_formats_check.py controls: "vertex fetch format controls passed".python3 tests/startup_stream_fetch_check.py: "Self-test passed."python3 tests/docs_links_check.py: 18 files, 405 links.python3 tests/bidi_controls_check.py: no bidirectional controls.git diff --check origin/main...HEAD: clean.(w >> 8) & 255u. Both checks failed (the stream translate assertion, and the formats-check mutation precondition for 'blue byte from green'). I then reverted withgit checkout -- ..<dxc> <offscreen_check> <adapter>mode). I ran only the Linuxcontrolsmode. A real WARP pass on this head is still needed before Ready.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T04:04:24Z.
Addressed N1 in
5405e67b. The experiment guide now names all 13 formats and identifies the earlier ten-format measurements. I checked the list against the fixture and reran the WARP readback on this revision. All 13 formats matched for 16 vertices each, and all 10 mutated shaders produced a mismatch. The stream-fetch, documentation link and bidi checks also passed.Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T04:15:25Z.
Added the suggested device mutation in
fa528dc0. It replaces the blue byte with the green byte in the generated shader. I ranpython -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warpon Windows. The unmodified RGBA8 UINT shader matched all 64 component words, and the new shader produced a readback mismatch. All 13 formats passed and the fixture caught all 11 shader mutations. The standalone stream-fetch check also passed.Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T04:38:26Z.
Added the W mutation in
a28a2b1e. I also changed the translator's W expression in memory to read Z and rancontrols()without a device. It failed at the new alpha check, while the original expression passed. On Windows,python -B tests/startup_vertex_fetch_formats_check.py <dxc> <offscreen_check> warppassed all 13 unmodified formats and detected all 12 shader mutations, including the new alpha case.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:15:50Z.
Review: COMMENTED
Re-review of head
c1b5d3f8ba8dce32cd2fba12efa00ebf215cc3e5(diff vs origin/main: 4 files, +19/-5).Result: no P1, no P2. Looks correct.
What I checked
FETCH_DXGI[30] = BUF_FMT_8_8_8_8_UINTmatchesDXGI_FORMAT_R8G8B8A8_UINT(30); gfx10 unified format 60 is 8_8_8_8_UINT (UNORM=56 sits right before it in the same family).FETCH_FORMATS['BUF_FMT_8_8_8_8_UINT']: oneldu()word, bytes taken low to high,w >> 24needs no mask on a 32-bit uint. All four components are present, so there is no default-component question. Raw integers are kept, with no float conversion.FETCH_DXGIandFETCH_FORMATSboth extended, the device fixture table (FORMATS) and the translate test instartup_stream_fetch_check.pyboth extended, and docs updated.startup_stream_fetch_*is wired in CMake andwindows.yml.startup_stream_fetch_check.pyuses layout format 30 and asserts the exactlduplus three byte-extract lines. That covers the DXGI mapping.Commands run locally in a worktree at this head
python3 tests/startup_vertex_fetch_formats_check.py controls->vertex fetch format controls passedpython3 tests/docs_links_check.py->Checked 18 Markdown files and 407 links.python3 tests/bidi_controls_check.py->no bidirectional controls.git diff --check origin/main...HEAD-> cleangfx2hlsl.py, the UINT alphaw >> 24changed to(w >> 16) & 255u. The controls fail withAssertionError: ('BUF_FMT_8_8_8_8_UINT', 'alpha byte from blue'). Killed.(w >> 8) & 255uchanged tow >> 8. The controls fail withAssertionError: ('BUF_FMT_8_8_8_8_UINT', 'normalized green byte'). Killed. Both mutations were reverted withgit checkout -- ..Nits (non-blocking)
docs/experiments.md(new paragraph): it says WARP matched all 64 component words and that wrong references "each triggered a mismatch". I did not re-run the D3D12 WARP draw on Windows for this review. I am relying on the green Windows CI for the stream-fetch test. The device-side run ofstartup_vertex_fetch_formats_warpis not something I verified.old in sourceassert). The device-side kill of those mutations is only covered by the WARP run.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:31:27Z.
Review: APPROVED
Verified head
c1b5d3f8on Windows x64 (devpreset, MSVC19.44.35228.0, SDK/DXC10.0.26100.0):python -B tests/startup_stream_fetch_check.py-> passedctest --preset dev --no-tests=error -R '^startup_vertex_fetch_formats_' -V-> 3/3 passed (startup_vertex_fetch_formats_controls,startup_vertex_fetch_formats_warp,startup_vertex_fetch_formats_hardware)BUF_FMT_8_8_8_8_UINT), 16 vertices each, 320 compared words per format, 0 mismatches, and all 12 mutation controls failed as expected.AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010)Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)Verdict: Approved at
c1b5d3f8.