Shaders: clamp inactive source lane in ds_bpermute_b32 before WaveReadLaneAt #3187
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3189"
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 Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T11:28:40Z.
Summary
crates/victory-shader/src/emit/lower.rs,ds_bpermute_b32passed the computed sourcelanedirectly toself.read_lane(x, lane)(dx.op.waveReadLaneAt.i32) before checkingrunningviawaveActiveBallot.WaveReadLaneAtis undefined behavior in DXIL/SM6.0+ (matching the bug fixed for DPP16/DPP8/ds_swizzle_b32in commitb51011aa).me = self.lane_index()(reused for wave64 half masking) andrunningbeforeread_lane, selectsafe_lane = select(running, lane, me), and passsafe_lanetoread_lanebefore zeroing inactive sources.Testing
Module::wave_read_lane_clamps_inactiveincrates/victory-shader/src/emit/bitcode.rsand asserted it inds_bpermute_wave64_preserves_32_lane_halffor both wave32 and wave64 (fails onmain, passes with the fix).cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningsandcargo test -p xtask --lockedpass.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T11:47:58Z.
Review: APPROVED
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-shader --lib ds_bpermute -- --test-threads=1: passed.cargo test -p victory-shader --lib emit::crosslane_tests:: -- --test-threads=1: 5/5 passed on RTX 5090 and WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly clamps inactive source lanes before
WaveReadLaneAtinds_bpermute_b32.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T11:47:12Z.
WARP verification of #3189 (head
707f71541c15446c3fd443ad42921059c45f970e)Environment: Windows 11 Pro 10.0.26200; WARP
D3D10Warp.dll10.0.26100.9818 (VICTORY_D3D12_WARP=1, physical GPU not used);dxil.dllanddxc.exe1.8.2502.11 from Windows SDK 10.0.26100.0 (VICTORY_DXILpoints at thatdxil.dll); rustc 1.98.1.Commands:
cargo test -p victory-shader --lib -j 4 --locked -- --test-threads=1, on the PR head and on the merge-base withmain(63bcca43c6a00a758510398fa43096ce7e4f7df0). The test builds the container and validates it with the SDKdxil.dll.emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_half, wave32 and wave64)read_lane(x, safe_lane)back toread_lane(x, lane)), test keptDefects found: none. Reading the diff,
runningis still computed from the unclampedlane, so inactive sources are still zeroed.lane_index()is now emitted for wave32 as well, and the test'suses_lane_indexassertion is updated to match. Note the test checks the DXIL structure (select onwaveGetLaneIndexfeedingwaveReadLaneAt), not lane values on a device; no WARP execution test covers it.AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). Test report only, no code changes. Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7190976040
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.