Shaders: a pixel program's killed lanes go on with their live quad (s_wqm), as on the console: sparkling glass #354

Open
github-bot wants to merge 2 commits from github-bot/gh-354 into main AGit
Owner

@⁠Serph91P on GitHub · 2026-11-26 18:16 UTC · original
Serph91P:shader-killed-lanes-live-quad → main · +125 −7 · 5 files · 2 commits · open

A glass material (PS_Textured_Eight, b37565055f2f7d3b) wrote NaN and values near 65504 into the scene colour at 560 to 1,590 texels of one small globe; depth of field turned each into a coloured bokeh dot that changed every frame. Two commits on 2de9980.

Cause: the program kills pixels in a 2x2 dither, then sums its probe lighting across the quad (quad_perm moves) and divides by the summed weight. On the console a killed lane of a live quad runs on as a helper until the export (s_wqm). structure.rs decided the "no lane live" branch on each lane's own bit, so killed lanes left at the kill and the quad reads took values from lanes that had returned. The module comment assumed helper values are read only through derivatives.

What this does

  • structure.rs: the condition of a mask operation whose result an s_wqm reads is "own bit or quad"; killed lanes of a live quad go on and are discarded at the export. Unit test added.
  • emit/lower.rs: a colour export before the last one is accepted under the same guard as the final export.
  • 13 of the title's programs then meet "a constant lane mask is not supported"; those are translated as before (a retry without the rule), so nothing that translated is lost.
  • TRANSLATOR_VERSION 1 → 2: about 19% of the archive's programs come out different. #353 also goes 1 → 2 on its own; whichever lands second needs 3.

Tested (RX 7900 XTX, RADV Mesa 26.3.1, vkd3d-proton 71cae091, Proton Experimental)

  • Recorded frame, three replays: 0 non-finite texels at the globe (before: 561, 1,357, 1,587), results equal across runs; outside the globe one more small glass object loses its blue dot, nothing else changes.
  • In the title: the globe and other small glass objects no longer sparkle (observer); steady frame time unchanged (median 66.8 ms against 63–67 ms).
  • This branch alone: builds for x86_64-pc-windows-msvc (cargo-xwin); the whole archive gives 25,694 that translate and 195 that do not, all for the reason they had before; cargo test -p victory-shader --lib (210 passed), cargo xtask policy and cargo test -p xtask pass.

Not tested: Windows, NVIDIA. The 13 programs that fall back (ten mirror materials, two red-dot sights, one glass) may still have the fault.

No game data in the commits.

🤖 Generated with Claude Code

**@⁠Serph91P** on GitHub · 2026-11-26 18:16 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/354) `Serph91P:shader-killed-lanes-live-quad` → `main` · +125 −7 · 5 files · 2 commits · open A glass material (`PS_Textured_Eight`, b37565055f2f7d3b) wrote NaN and values near 65504 into the scene colour at 560 to 1,590 texels of one small globe; depth of field turned each into a coloured bokeh dot that changed every frame. Two commits on 2de9980. **Cause:** the program kills pixels in a 2x2 dither, then sums its probe lighting across the quad (`quad_perm` moves) and divides by the summed weight. On the console a killed lane of a live quad runs on as a helper until the export (`s_wqm`). `structure.rs` decided the "no lane live" branch on each lane's own bit, so killed lanes left at the kill and the quad reads took values from lanes that had returned. The module comment assumed helper values are read only through derivatives. **What this does** - `structure.rs`: the condition of a mask operation whose result an `s_wqm` reads is "own bit or quad"; killed lanes of a live quad go on and are discarded at the export. Unit test added. - `emit/lower.rs`: a colour export before the last one is accepted under the same guard as the final export. - 13 of the title's programs then meet "a constant lane mask is not supported"; those are translated as before (a retry without the rule), so nothing that translated is lost. - `TRANSLATOR_VERSION` 1 → 2: about 19% of the archive's programs come out different. #353 also goes 1 → 2 on its own; whichever lands second needs 3. **Tested** (RX 7900 XTX, RADV Mesa 26.3.1, vkd3d-proton 71cae091, Proton Experimental) - Recorded frame, three replays: 0 non-finite texels at the globe (before: 561, 1,357, 1,587), results equal across runs; outside the globe one more small glass object loses its blue dot, nothing else changes. - In the title: the globe and other small glass objects no longer sparkle (observer); steady frame time unchanged (median 66.8 ms against 63–67 ms). - This branch alone: builds for `x86_64-pc-windows-msvc` (cargo-xwin); the whole archive gives 25,694 that translate and 195 that do not, all for the reason they had before; `cargo test -p victory-shader --lib` (210 passed), `cargo xtask policy` and `cargo test -p xtask` pass. **Not tested:** Windows, NVIDIA. The 13 programs that fall back (ten mirror materials, two red-dot sights, one glass) may still have the fault. No game data in the commits. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The console compiler kills a pixel by clearing it from the live mask
(`s_andn2 live, live, exec`), leaves when no lane of the wave is left
(`s_cbranch_scc0`), and otherwise goes on in whole-quad mode
(`s_wqm` of the live mask): a killed lane of a live quad still runs, as a
helper, until the export. The structurisation took that branch on the
lane's own bit, so a killed lane left the program at once. That is right
where a killed lane only fed derivatives, but a glass material
(`PS_Textured_Eight`, b37565055f2f7d3b) kills in a 2x2 dither and then
sums its probe lighting over the quad with DPP quad permutations, which
read the killed neighbours' partial sums: on the host those lanes had
left, the reads were undefined, and the glass wrote NaN or about 65504
into the scene colour, different from run to run; depth of field made
them blue, green and magenta bokeh that flickered ("disco ball").

SCC of a mask operation whose result an `s_wqm` reads is now "some lane
of my quad is set" (Atom::Quad, which the lowering takes as true, as it
does for `s_wqm` itself), so such lanes go on; they are killed at the
export, where EXEC is the live mask again. A colour export before the
last one under that same EXEC is accepted (the last one discards).

Capture-4, replayed with the 101 of 1,716 programs whose translation
changes (42 of the frame's 1,254 pipelines): the globe's texels after the
glass draw are finite in three runs (1,200 to 1,600 NaN before), a second
blue bokeh dot of a small glass object is gone, and outside the globe the
picture is unchanged but for that dot (PSNR 51.7 dB against the unchanged
replay with the globe masked).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
With 54f1092, 13 pixel programs that translated before stopped with "a
constant lane mask" (PS_MirrorReflectionTextured_Eight x10,
PS_FPWeaponRedDot x2, PS_Textured_Eight x1, at 0x31a4 to 0x4094): their
killed lanes, now going on with their live quad, reach a lane test the
lowering cannot make on host lanes. Such a program is translated once
more with killed lanes leaving at the kill (structure::without_live_quads,
which `emit::translate` and the `translate` tool try after that
refusal), the translation it had before.

The archive (shaders.rpf): 25,694 shaders in the cache, 195 do not
translate (all "a container without a vertex, pixel, compute or mesh
program", as before 54f1092). 54f1092 changed the output of 4,856 of
them (about 19%), so TRANSLATOR_VERSION goes to 2. The glass globe of
capture-4 stays clean in three replays.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:20:54 +00:00
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 21:40 UTC · original

I have a possible second scene to test on the Radeon branch. In the transition to a blurred face in the opening cutscene, large bright squares appear over the face, followed by dark squares, then the same area clears. In three consecutive 4 Hz captures, a 10×10 patch at one bright square averaged RGB (210,222,234), (45,36,28), (45,36,28). A separate patch went (39,30,23), (11,9,5), (39,30,22). This was on the RX 7900 XT, RADV 26.3.1, Wine 11.22, with the ambient reflection pass enabled. My executable predates this shader change. The capture establishes the transient squares. I haven’t identified the material or checked whether your fix changes this scene.

**@⁠UwUCammie** on GitHub · 2026-11-26 21:40 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/354#issuecomment-7203958082) I have a possible second scene to test on the Radeon branch. In the transition to a blurred face in the opening cutscene, large bright squares appear over the face, followed by dark squares, then the same area clears. In three consecutive 4 Hz captures, a 10×10 patch at one bright square averaged RGB (210,222,234), (45,36,28), (45,36,28). A separate patch went (39,30,23), (11,9,5), (39,30,22). This was on the RX 7900 XT, RADV 26.3.1, Wine 11.22, with the ambient reflection pass enabled. My executable predates this shader change. The capture establishes the transient squares. I haven’t identified the material or checked whether your fix changes this scene.
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-26 21:57 UTC · original

The affected pixel shader was bound before the diner artifact in both 720p captures. The log does not identify which material drew the flashing squares.

I also found that if the constant-mask retry unwinds and its caller catches the panic, the next shader on that worker can inherit disabled live-quad handling. The regression test fails on 301867af and passes with the scoped restore. I sent the fix directly against this branch. The native shader suite passed 211 tests, with two ignored. Scoped restore and regression test

**@⁠UwUCammie** on GitHub · 2026-11-26 21:57 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/354#issuecomment-7204221252) The affected pixel shader was bound before the diner artifact in both 720p captures. The log does not identify which material drew the flashing squares. I also found that if the constant-mask retry unwinds and its caller catches the panic, the next shader on that worker can inherit disabled live-quad handling. The regression test fails on 301867af and passes with the scoped restore. I sent the fix directly against this branch. The native shader suite passed 211 tests, with two ignored. [Scoped restore and regression test](https://github.com/Serph91P/VIctory-7900XTX/pull/1)
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-27 05:00 UTC · original

The 720p cold pair finished on RX 7900 XT with RADV and GE vkd3d-proton cae8353ed7959c4. Both launches had the reflection clamp enabled. The live-quad translator plus unwind fix accepted 2,525 presents in 300 seconds, against 2,409 on the control. The P99 gap went from 921 ms to 2,209 ms. Several late living-room shots matched, with similar lighting in the sampled frames. The available matches and 4 Hz capture don't establish whether the diner flicker changed. Run details

**@⁠UwUCammie** on GitHub · 2026-11-27 05:00 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/354#issuecomment-7210273811) The 720p cold pair finished on RX 7900 XT with RADV and GE vkd3d-proton `cae8353ed7959c4`. Both launches had the reflection clamp enabled. The live-quad translator plus unwind fix accepted 2,525 presents in 300 seconds, against 2,409 on the control. The P99 gap went from 921 ms to 2,209 ms. Several late living-room shots matched, with similar lighting in the sampled frames. The available matches and 4 Hz capture don't establish whether the diner flicker changed. [Run details](https://github.com/UwUCammie/victory-amd/commit/694fcb34)
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/354/head:github-bot/gh-354'
git switch 'github-bot/gh-354'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-354'
git switch 'github-bot/gh-354'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-354'
git switch 'github-bot/gh-354'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-354'
git switch 'main'
git merge --squash 'github-bot/gh-354'
git switch 'main'
git merge --ff-only 'github-bot/gh-354'
git switch 'main'
git merge 'github-bot/gh-354'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.