Shaders: honor EXEC guards in Lower::interp #3149
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3149
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3149"
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?
@Arkenoz on GitHub · 2026-11-26 10:23 UTC · original
Arkenoz:fix/shader-interp-exec-guard→main· +345 −9 · 2 files · 1 commits · openSummary
Fixes missing
EXECguard handling when writing interpolation results inLower::interp(crates/victory-shader/src/emit/lower.rs):vdstwrites:ir.rsandstructure.rsalready classifyFields::Vintrpinstructions as vector writes governed byEXECand computeguards[b][i], butLower::interppreviously passedNonetowriteandwrite_half. While the interpolation evaluation itself runs across lanes, the write tovdstmust still preserve inactive lanes under narrowedEXEC(v_cmpx_*,s_and_saveexec_*).Lower::interpnow queriesself.guard(site.0, site.1)?and applies it tov_interp_mov_f32,v_interp_p2_f32, andv_interp_p2_f16.p1vdston shared-destinationp1 + p2pairs: Whenv_interp_p1_*andv_interp_p2_*target the same VGPR,p1is not emitted to DXIL and recordsVal::Missing(_), which would otherwise collapse inactive lanes to0onp2. AddedLower::interp_oldto trace back top1.read(Reg::V(reg))whenbools.meetprovesp1never executed on lanes outsidep2's guard (andreach[b] => reach[b1]).v_interp_p2_f16): Factoredwrite_placed_with_oldandwrite_half_with_oldso active lanes keep existing half-preservation/modifier behavior while inactive lanes preserve the full previous (or pre-p1)vdst.Leaves
omod/clamp/op_sel[3]andSV_Barycentricspaths untouched to avoid conflicts with open PRs.Testing
emit::tests::guarded_interpolation_preserves_inactive_lanesincrates/victory-shader/src/emit/mod.rs, running 5 synthetic pixel shaders viaHost::draw(verified failing before the fix and passing after on both NVIDIA RTX 3060 and WARP, with DXIL validation):v_interp_mov_f32v_interp_p1_f32+v_interp_p2_f32(sharedvdst)v_interp_p1ll_f16+v_interp_p2_f16(low half, separatevdst)v_interp_p1ll_f16+v_interp_p2_f16(sharedvdst)v_interp_p1ll_f16+v_interp_p2_f16(op_sel[3] = 1high half, separatevdst)rustfmt --edition 2024 --check— 0 diffs on all touched/added linescargo clippy --workspace --all-targets -- -D warnings— passedcargo check --workspace --all-targets— passedcargo xtask policy— passed (asset policy: 191 files ok)cargo test -p victory-shader --locked --lib emit::tests::— passed (18 passed; 0 failed)Coordination & AI disclosure
@Dukestar69 on GitHub · 2026-11-26 10:27 UTC · original · approved these changes
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-shader --lib guarded_interpolation_preserves_inactive_lanes -- --test-threads=1: passed.cargo test -p victory-shader --lib emit::lower::tests:: -- --test-threads=1: 33/33 passed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly honors EXEC guards in
Lower::interpso inactive lanes preserve their prior VGPR values.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.