Shaders: honor op_sel, omod and clamp on v_interp_p2_f16 #1695
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1696"
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 Calvix2k on 2026-11-24T20:49:43Z.
Addresses
VIC-BT-029from audit #1242.Summary
v_interp_p2_f16is a VOP3 instruction withop_sel[3](destination half),omodandclamp, but the lowering always wrote the low half vialow_halfand dropped the modifiers.write_half, which honorsop_sel[3]and the SDWA destination word while keeping the untouched half.omod(mul:2, mul:4, div:2) is applied first, thenclamp, in f32 around a singlelegacyF32ToF16conversion — the same orderwrite_fuses for f32 results.Test
interpolated_f16_writes_the_op_sel_half_with_modifiersbuilds a synthetic pixel shader (v_interp_p1_f32+v_interp_p2_f16+mrt0export), dumps the emitted DXIL withdxc -dumpbinand checks:shl i32), the low-half form keeps the destination's high half;omodemits the multiply by 2.0 andclampemitsdx.op.unary.f32opcode 7;Against
lower.rsfrommainthe test fails on the high-half assertion.Validation
cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests— passed (103 tests, 1 ignored).cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings— passed.cargo xtask policy— passed (154 files).Note: the DXIL check pins the emitted operations; numeric behavior of f16 clamp follows the crate's existing 16-bit float convention (saturate via DXIL
fSat).Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T20:56:56Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-shader --lib interpolated_f16_writes_the_op_sel_half_with_modifiers— passedcargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— okClean
half_modifiershandling forop_sel,omod, andclamponv_interp_p2_f16with targeted DXIL verification. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:40:05Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.v_interp_p2_f16 honors op_sel, omod and clamp: half_modifiers applies the modifiers to the selected half; the macOS-visible test asserts the low write keeps the high half and op_sel[3] shifts to the high half in DXIL.
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:05:53Z.
Rebased onto upstream
70564ae; the only conflict was the test module (upstream added its own pixel-shader helpers, this PR adds the DXIL dump check). Resolution keeps both.cargo check -p victory-shader --tests --lockedpasses on the resolved tree.Full test/clippy validation is deferred because the local disk filled during the rebase batch; CI will run it. No code change beyond the rebase.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T22:52:02Z.
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
e29391f(onmain70564ae).interpolated_f16_writes_the_op_sel_half_with_modifierspasses on the hardware adapter.AI-assisted (Claude Code). Synthetic tests only.