Shaders: honor op_sel, omod, and clamp on v_interp_p2_f16 (port of upstream VIctory #1696) #934
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!934
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-934"
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?
@Moon0755 on GitHub · 2026-11-25 13:11 UTC · original
Moon0755:fix/interp-p2-f16-modifiers→main· +185 −2 · 2 files · 1 commits · openPorts upstream Marvisak/VIctory#1696 (
Calvix2k), adapted directly to this fork'sf32intermediate value inLower::interp.What changed
crates/victory-shader/src/emit/lower.rs(Lower::interp):f16v_interp_p2_f16results, apply VOP3omod(×2,×4,÷2) andclamp(saturate) directly to thef32value beforelegacyF32ToF16narrowing (matchingwrite_fand avoiding an extraf32 → f16 → f32 → f16round-trip).self.write_half(inst, lo, None)instead ofself.low_half(inst, reg, lo), soop_sel[3](high destination half) and SDWA destination selection are honored while keeping the untouched half intact.crates/victory-shader/src/emit/mod.rs:v_interp_p2_f16_translates_and_validates(checks translation anddxil.dllvalidation across low-half, high-half +omod=1+clamp, and high-half +omod=3).v_interp_p2_f16_honors_op_sel_omod_and_clamp_on_gpu(draws a fullscreen triangle withTEXCOORD0.x = 0.75on D3D12/WARP and checks bit-for-bit that the untouched half ofv3(0x3800_3400) is preserved andop_sel[3],omod, andclampproduce0x3800_3A00,0x3C00_3400, and0x3600_3400).Why (RDNA2 / Xbox Series X hardware semantics)
v_interp_p2_f16is a VOP3 instruction carryingop_sel[3](destination half select),omod, andclampmodifiers. Previously, lowering always wrote the low 16 bits vialow_halfand droppedomodandclamp, which overwrote the wrong half wheneverop_sel[3]targeted bits[31:16]and produced wrong values for scaled/clampedf16pixel attributes.Verification
Verified on
windows-latestvia GitHub Actions run #45620428420 (scoped to-p victory-shader -p xtask, as workspace-wide clippy onmaincurrently fails on unrelated pre-existing items invictory-gpu):cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings: passedcargo clippy -p victory-shader -p xtask --all-targets --all-features --locked -- -D warnings: passedcargo test -p victory-shader -p xtask --locked -- --nocapture:victory-shader: 217 passed, 0 failed (3 ignored), includingdxil.dllvalidation andwarp: v_interp_p2_f16 op_sel/omod/clamp verifiedxtask: 4 passed, 0 failed (repository_passes_policyok)— 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.