Shaders: honor op_sel[3] and modifiers in f16 interpolation #81
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/81"
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 DexNom/VIctory. Originally posted by BlueCatsz on 2026-11-26T16:28:09Z.
Fixes three 16-bit pixel interpolation bugs in
victory-shader:Summary of Changes
Preserve
op_sel[3]and output modifiers onv_interp_p2_f16(crates/victory-shader/src/emit/lower.rs)Lower::interp,v_interp_p2_f16previously ignoredv.omod/v.clamp, bypassedf16_nearest_on()(VICTORY_F16_NEAREST=1), and always wrote viaself.low_half, overwriting the low 16 bits even whenop_sel[3]selected the high half.v.omod(×2,×4,×0.5) andv.clampinf32before converting once throughto_f16(which honorsf16_nearest_on()), and writes the result withself.write_half(inst, lo, None)soop_sel[3]places the half while preserving the untouched half.to_f16in the flatMode(1)path also sharesf16_nearest_on().Honor modifiers on
v_interp_p1ll_f16(crates/victory-shader/src/io.rs,crates/victory-shader/src/emit/lower.rs)Halves::pair, pairedv_interp_p1ll_f16instructions withclamp,omod,abs, ornegmodifiers were folded intoInterp::Interpolated(which skips loweringp1ll), silently dropping those modifiers.kind = Nonewhenv_interp_p1ll_f16carries modifiers so both halves lower viaInterp::Weighted, andLower::interpfinishesv_interp_p1ll_f16viaself.write_f(inst, f, None)(soomod/clampapply inf32andabs/negare rejected rather than ignored).Synthetic Tests (zero game files)
io::tests::f16_first_half_with_modifiers_falls_back_to_weightedemit::barycentric_tests::interpolated_f16_honors_op_sel_and_output_modifiers(verifiesop_sel[3],omod,clamp,TEST_F16_NEAREST,p1llomod/clampDXIL emission, and rejection ofp1llneg)emit::barycentric_tests::interpolated_f16_draw_checks_high_half_modifiers_and_single_rounding(#[cfg(windows)]D3D12/WARP draw test asserting exact 16-bit bit patterns for high-halfop_sel[3], pre-narrowingomod/clamp, single rounding of(2^-15 + 2^-25) * 4.0 -> 0x0801, low-half preservation, andv_interp_p1ll_f16clamp)Verification
windows-latestCI (Rust1.98.1, MSVC):CI / check(Clippy --workspace --all-targets -- -D warnings,Clippy --all-features -- -D warnings, andcargo test --workspace --lockedwithVICTORY_TESTS_ALLOW_SOFTWARE_SKIP=1,victory-shader:242 passed; 0 failed; 4 ignored,xtask:4 passed; 0 failed) &Screen / screenboth passed.x86_64-unknown-linux-gnu):cargo test --offline --locked -p victory-shader --lib(184 passed; 0 failed; 2 ignored),cargo clippy --offline --locked -p victory-shader --lib -- -D warnings(0warnings),cargo --offline xtask policy(asset policy: 210 files ok), andgit diff --checkall passed.Antigravity). Verified with synthetic unit tests and D3D12/WARP draw tests only; no game executable, asset files, or in-game hardware benchmark were run.Imported from DexNom/VIctory. Originally posted by andrewDoing on 2026-11-26T22:43:20Z.
At the exact PR head tested:
Independent Windows hardware check at
2bc1252: all three PR tests passed. A non-skippable extended draw confirmed both RTX 5070 and WARP. Both returned expected half-bit vectors[7a00,3c00,0801,0000]and signed/fractional case[bc00,3000,c000,3a00]under both rounding settings. A control using base lowering and IO code with the same harness produced[3a00,47c0,b800,0000]for the first RTX pixel instead of the expected vector. No gameplay scene tested.Verification was AI-assisted with GPT-6.2 Astra.
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.