Repository navigation
SHADER-492: preserve swapped fragment interpolation weights - #2711
Conversation
A swapped input can be the first read of a barycentric register, and either operand can replace an interpolation weight. Preserve incoming weights and invalidate copies so a fragment uses the values its program exchanged.
|
Independent Vulkan run of Alongside raw weight swapping, direct overwrite and overwrite through a saved copy, I checked swapping both weights before interpolation, swapping I under an EXEC mask that covers exactly half the image, and replacing J between the p1 and p2 of a pair. The masked case preserved the original I on the other 2,048 pixels. The two channels distinguish I from J on the fullscreen triangle. All twelve modules passed The GPU comparison uses a synthetic triangle and Vulkan barycentric inputs. Native AMD wave64 execution and the retail corpus were outside this run. |
|
Tested on Linux (WSL2 Ubuntu), Python 3.10.12, CPU only: pass. With upstream/main merged (clean), tests/semantic/test_interp_computed_ij.py runs 17 tests, OK. Negative control: restoring tools/rdna2spirv.py to upstream/main makes 3 of the 17 fail (the new v_swap_b32 cases); the other 14 pass on main as expected. Trial merges are clean with #2722, #2710, #2664 and #2715 (the full tests/semantic suite with #2722 merged also passes: 2574 OK, 3 skipped). |
|
Corpus run of
AI-assisted (Claude Code). Counts only; nothing from the game files is included. |
Keep the targeted regression and the intervening upstream changes together for review.
Keep the targeted regression and the intervening upstream changes together for review.
|
Tested
AI-assisted (Claude Code). Synthetic shaders only, no game files. |
|
Independent Apple Silicon / MoltenVK check of head
This PR adds no GPU fixture of its own, so the swapped-interpolation-weight fix is checked here only by the semantic tests, not on hardware. No code changes, no game data; counts only. AI-assisted. |
|
Tested Setup: the PR diff applied to
No game files. AI-assisted (Claude Code); I ran the commands above and checked the numbers against the logs. |
Claimed in the coordination issue as SHADER-492.
What and why
v_swap_b32exchanges both register values. Pixel input discovery missed the original value in the first operand, and interpolation could continue using a hardware weight after the swap had overwritten the second operand. The changes track both reads and writes and invalidate stale weight copies. A pair with a computed weight also initializes its hardware weights when interpolation is their only consumer. AMD RDNA2 ISA, VOP1Tested
spirv-val --target-env vulkan1.2before and after.(0.5, 0, 0.5, 0). The CPU interpreter now gives(0.5, 0.25, 0.5, 0.25).(0.5, 1, 0.25, 0.5)and now give the expected(0.25, 1, 0.25, 0.25). The green channel checks that J still comes from the original triangle.AI-assisted with Codex.
Checklist
docs/design.md, with how it was confirmed.