Repository navigation
shader: lower pixel compare masks composed with VCC in a whole-quad tail (Part of #3309) - #3401
Open
SimSalabimse wants to merge 2 commits into
Open
SimSalabimse wants to merge 2 commits into
SimSalabimse wants to merge 2 commits into
Conversation
A whole-quad pixel tail can AND, OR, or ANDN2 a two-SGPR compare with VCC, keep that pair across a 64-bit move, and refuse a half overwrite or an SCC read whose wave-wide result is not uniform. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
A vertex class-mask high-half overwrite must still refuse as an unproven CNDMASK source. The pair tracker was recording every graphics compare. Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Part of #3309. Refs #2413, #3210, #870, #3308. The work sits on the pixel path added in #3091.
A gfx1013 pixel tail in whole-quad mode can now combine a named two-SGPR compare mask with VCC. It handles
s_and_b64,s_or_b64ands_andn2_b64(S0 & ~S1), ands_mov_b64keeps the lane bit when the pair is copied. Some cases are still refused:compare mask half overwritten.SCC read without an established wave-wide nonzero result.This tracking runs only in the pixel whole-quad tail (
whole_quadorexact_after_wqm). A vertex class-mask high-half overwrite still refuses asunproven graphics CNDMASK source, the same as on main.Verification
All results are for commit
ed447c29cff990b278a1aaabbac9e449866759fc.On the Windows test PC (Debug
devpreset, D3D12 debug layer on), the adapters were Microsoft Basic Render Driver (WARP) and NVIDIA GeForce RTX 4070 Ti with driver 32.0.16.2135. The command was:It passed 7 of 7 with ctest exit 0.
native_pixel_compare_mask_warp,_hardware,_container(validated DXIL) and_irall passed.native_fixed_mesh57_compare_vcc_warpand_hardwarepassed. The reviewed stage pair links and creates a color PSO from the captured root and attachment state.native_direct_containerpassed.An earlier commit,
30f6606b, failednative_direct_containeronvertex-class-mask-high-overwritebecause the tracker also ran on vertex compares.ed447c29limits it to the pixel whole-quad tail.On Linux:
python -m compileall -q tools testsexited 0.python-linuxlist passed all 258 checks.tests/native_pixel_compare_mask_check.py, in both normal andirmode, exited 0.Evidence and follow-up
The fixture words are written by hand in
tests/native_pixel_compare_mask_check.py, with no game files or dumps. The diagonal draw coversx + y < 5.5, so pixel(4,0)is covered and(4,1)is a helper lane. The mask isy > 1under whole-quad execution, and VCC isx > 2after exact coverage returns. Uncovered pixels stay at the clear value, -1.Each negative control was shown to fail when its check was removed:
v_cndmaskguard let the container lower with the stale bit.s_andn2_b64 s[6:7], s[4:5], vccasvcc & ~mask, and the draw test expectspixels differ.The fixed-mesh readback is the slot 57 target, not the 8×2 fixture. Reproduction notes are in
docs/experiments/pixel-compare-mask-vcc.md.Checklist
AI-assisted (Cursor)