shader: use a uniform mesh mask proof inside a narrowed lane skip (Part of #3703) #3946
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3946"
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 R0Y00/Xbox2Windows. Originally posted by mumba17 on 2026-12-03T16:15:00Z.
Part of #3703 (row R1,
v_readfirstlane_b32; claim: https://github.com/R0Y00/Xbox2Windows/issues/3703#issuecomment-7384414865).Problem
mask_uniformrecords that a lane mask has the same bit on every lane of a lane set: an EXEC-or-zero mask (s_cselect_b64 sN, exec, 0), a compare of uniform values, and their complements and ORs.v_cndmask_b32on such a mask with uniform sources is then uniform on the active lanes, and a followingv_readfirstlane_b32reads it without a broadcast. The cndmask accepted the proof only when the current lane set was exactly the mask's (first==lane_active). When the select runs inside a per-lane CMPX skip nested under the mask's lanes, the proof was dropped. The read then needed the groupshared broadcast, which a per-lane skip cannot use, and was refused withunsupported mesh instruction or EXEC state: v_readfirstlane_b32.Change
Use
covered_by(lane_active, mask_uniform.at(bit).first), the check the SAVEEXEC, CMPX-parent and VCC-branch proofs on the same map already use. Every lane in a set narrowed from the mask's lanes has the mask's bit, so the select still picks one uniform source. Nothing else changes; a select on a per-lane mask is still refused inside the skip.Tests (
native_direct_mesh)uniform-exec-mask-in-lane-skip:s_cselect_b64 s[30:31], exec, 0under full EXEC, then a per-lanev_cmpxskip withs_cbranch_execz, and inside itv_cndmask_b32 v6, 0, 1, s[30:31]andv_readfirstlane_b32 s18, v6. It translates with nomeshReadFirstLaneslot and no barrier, and the read lowers to a select on the scalar condition.varying-exec-mask-in-lane-skip: the same with the mask from a per-lanev_cmp_eq_u32 s[30:31], 0, v0. Still refused.uniform-exec-mask-in-lane-skipfails with thev_readfirstlane_b32refusal.Census
Our native Mesh86 capture (RTX 3090, 600 s): 6,685 distinct
.m86programs, each run once throughcompile_dxil … gfx1013-container-ms-texture-heap.mainc6a0b036: 2,163 translate; 160 stop atv_readfirstlane_b32.v_cmpx_lt_u32(that form is not the wide SAVEEXEC one in #3922: the 99 still stop there with #3922 stacked). No other program's first refusal changes.Counts only; request bytes stay local.
Checks
Windows 11 build 26300, MSVC (VS Build Tools 14.44), SDK/DXC 10.0.26100.
ctest --preset pron this commit (rebased onmainac81f34e): 349/351 pass,native_direct_meshincluded. The two local failures,native_compute_implicit_lod_controlsandnative_wave_virtual_derivative_controls, are the local SDK validator 1.7 vs DXIL 1.8 and fail onmaintoo. The census was measured onc6a0b036and not rerun after the rebase.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T16:22:07Z.
Review: APPROVED
Reviewed
ab63fb4f. The mask proof is inherited only along the existing lane-mask ancestry check and both selected values still require uniform proofs. A varying mask still refuses the in-skip readfirstlane. Independently rebuilt compile_dxil in MSVC Debug and ran ctest --test-dir out/build/review --no-tests=error -R '^native_direct_mesh$' --output-on-failure (1/1, no skips). Reverting the ancestry check to exact mask equality made uniform-exec-mask-in-lane-skip fail at +0x44 with the prior v_readfirstlane_b32 refusal. This is source-built compile and emitted-DXIL evidence.