Guard pixel quad reads from lanes that did not run the block (VICTORY_QUAD_GUARD) #28

Closed
github-bot wants to merge 1 commit from github-bot/gh-28 into main AGit
Owner

@⁠ramc1312 on GitHub · 2026-11-30 12:33 UTC · original
ramc1312:quad-guard → main · +42 −3 · 3 files · 1 commits · closed without merging

Glass drawn by PS_Textured_Eight (variant b37565055f2f7d3b) shows coloured overflow blocks and flashes, different every frame (lanterns, bottles, bar glass).

Cause. The shader sums colour and weight over the 2×2 quad with v_mov_b32 … quad_perm:[1,0,3,2] / [2,3,0,1] bound_ctrl:1 fi:1, then divides the colour sums by the weight sum. On the console a lane outside EXEC still holds its register value, 0 for a sum it never added to. On the host the neighbour's value is undefined when it did not take the branch, so the sums take in noise and the mean divides by it.

Change. VICTORY_QUAD_GUARD=1 reads the source and a source-dependent XOR marker through the same quad operation; where the pair does not match (the neighbour did not run this code) the read gives 0. =2 also applies this to pixel ds_swizzle quad reads. Off by default, and part of the shader cache key.

Measured (RX 7900 XTX, Linux, RADV with the xmem patch, Proton; night scene at the glass lanterns, brightness cap off): the raw forward target had 350–1,400 glass pixels above 8 before, dozens of them at 65,504; with =1 it has none. Frame rate unchanged at about 50 fps.

Limits. Runtime-tested on the 5a60834 base only so far; this port to current main is compile-tested. (An earlier version of this text said main was black on this card: that was my own mistake, a missing d3dcompiler_47.dll beside the executable, corrected in #6. I will run this branch on main and report here.) Particles, driving and long sessions were not checked. =2 made no visible difference in my scenes.

🤖 Generated with Claude Code

**@⁠ramc1312** on GitHub · 2026-11-30 12:33 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/28) `ramc1312:quad-guard` → `main` · +42 −3 · 3 files · 1 commits · closed without merging Glass drawn by `PS_Textured_Eight` (variant `b37565055f2f7d3b`) shows coloured overflow blocks and flashes, different every frame (lanterns, bottles, bar glass). **Cause.** The shader sums colour and weight over the 2×2 quad with `v_mov_b32 … quad_perm:[1,0,3,2] / [2,3,0,1] bound_ctrl:1 fi:1`, then divides the colour sums by the weight sum. On the console a lane outside EXEC still holds its register value, 0 for a sum it never added to. On the host the neighbour's value is undefined when it did not take the branch, so the sums take in noise and the mean divides by it. **Change.** `VICTORY_QUAD_GUARD=1` reads the source and a source-dependent XOR marker through the same quad operation; where the pair does not match (the neighbour did not run this code) the read gives 0. `=2` also applies this to pixel `ds_swizzle` quad reads. Off by default, and part of the shader cache key. **Measured** (RX 7900 XTX, Linux, RADV with the xmem patch, Proton; night scene at the glass lanterns, brightness cap off): the raw forward target had 350–1,400 glass pixels above 8 before, dozens of them at 65,504; with `=1` it has none. Frame rate unchanged at about 50 fps. **Limits.** Runtime-tested on the 5a60834 base only so far; this port to current main is compile-tested. (An earlier version of this text said main was black on this card: that was my own mistake, a missing `d3dcompiler_47.dll` beside the executable, corrected in #6. I will run this branch on main and report here.) Particles, driving and long sessions were not checked. `=2` made no visible difference in my scenes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A DPP quad_perm read with fi:1 fetches a quad neighbour's register lane even
when that lane is outside EXEC; on the console it then holds what it last
held, 0 for a sum it never added to. On the host the neighbour's value is
undefined when it did not take the branch, so quad sums take in noise.

VICTORY_QUAD_GUARD=1 makes a second quad read of the value XORed with a fixed
marker at the same place and gives 0 where the pair does not match. =2 also
guards pixel ds_swizzle quad reads. Off by default; part of the shader key.

Runtime-tested on the 5a60834 base (RX 7900 XTX, RADV); compile-tested here.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 07:41:38 +00:00
github-bot closed this pull request 2026-12-02 01:56:36 +00:00
Author
Owner

@⁠goldfishdev on GitHub · 2026-12-02 01:53 UTC · original

Merged to main as cherry-picked commit 0bab220 (VICTORY_QUAD_GUARD). Thanks for the fix!

**@⁠goldfishdev** on GitHub · 2026-12-02 01:53 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/28#issuecomment-7332233082) Merged to main as cherry-picked commit `0bab220` (VICTORY_QUAD_GUARD). Thanks for the fix!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.