xshader: supply launch registers an instruction reads through its destination #624
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/624"
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 brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T15:08:49Z.
The translation sets a launch register (a pixel program's fragment position, a scalar argument) only when its entry-live analysis says the program reads it before writing it. That analysis took every decoded destination as a plain write, but several instructions also read their destination:
v_fmac_f32,v_fmac_f16,v_pk_fmac_f16,v_dot2c_f32_f16,v_dot4c_i32_i8, the mac forms;v_fma_mixlo/hi_f16, the 16-bit integer VOP3 forms, the compactv_rcp_f16, SDWA withUNUSED_PRESERVE, DPP16 withoutBOUND_CTRL, D16 loads,v_writelane_b32,v_interp_p2;s_cmov,s_cmovk,s_bitset,s_addk,s_mulk,s_cmpk.v_readlane_b32also names the scalar it writes in its vector field, ands_cmpkwrites nothing. A register whose first use is such an instruction kept its declared 0. In recorded requests of one title, 1,385 pixel programs first use the fragment position as the addend ofv_fmac_f32(a per-pixel hash for dithering and fades), so x and y read as 0 everywhere.Also:
SPI_PS_INPUT_ENA. When the enable and the signature disagreed, the old fallback put x, y, z or 1/w into registers that hold no position.Refs #533.
Measured
Main
833e1217and this head, side by side on every one of 55,257 recorded request/host translations from one title:Tests: the new tests in
tests/hlsl/live_reads.rsfail without the change (checked by reverting each part).tools/check_pixel_interp.pygains apositioncase (16×16, expects (x+0.5, y+0.5, 0.5, 1.0) at every pixel).fe4d8597(GE-Proton11-15) on an AMD iGPU (1002:13c0, RADV) and an RTX 5090 (10de:2b85, 620.70.10):pixel-interppasses on both (4 cases, 1,024 pixels, 0 wrong). Control (main plus only the check): fails on both, position at pixel [0,0] expected [0.5, 0.5, 0.5, 1.0], got [0, 0, 0, 0]; smooth, flat and half pass.pixel-link-slot86, an lld-link error linking the check's guest; it fails the same way on the control).shader-cache,raster-tables,compute-root,compute-root-recovery,bindless-compute: 50 of 50 on both cards.Evidence: TuxBox check of fe4d8597792d, no uncommitted changes, no GPU checks: 13 passed, 0 failed, 0 not runNot covered
SOFFSETand multi-register vector operands are a follow-up; so is following control flow instead of program order (it would newly refuse mesh programs whose launch registers are written conditionally, which needs the mesh path's own proof first).🤖 Generated with Claude Code