Shaders: honor modifiers in f16 conversions #1544
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1545"
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-24T19:01:34Z.
Summary
Fixes modifier handling in the
opsel == 0fast paths for two 16-bit conversion instructions:v_cvt_f32_f16now uses the existing half-float source path, preserving VOP3absandnegsemantics.v_cvt_f16_f32applies VOP3clampbefore converting the f32 value to f16.Verification
cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: passed.cargo xtask policy: passed (154 files ok).rustfmt --edition 2024 --checkonvalu_tests.rs: passed.lower.rshas pre-existing formatting differences elsewhere in the file.cargo test -p victory-shader --locked -- --test-threads=1: 107 passed, 1 ignored, 15 failed because existing GPU tests require an available SM 6.6 hardware/WARP device, which this system lacks.Synthetic tests only; no game assets used.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T19:20:53Z.
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. Execution/valu tests are#[cfg(all(test, windows))]and were not run here.f16 conversions honor VOP3 modifiers:
v_cvt_f16_f32applies CLAMP to the f32 source beforelegacyF32ToF32→F16 conversion, andv_cvt_f32_f16goes throughhalf_fsrcso ABS/NEG on the f16 source work. Two valu tests pin clamp-before-convert (high half preserved: 0xbeef_1234 → 0xbeef_0000) and abs-then-neg (0x3c00 → 0xbf80). Windows-only execution; 96 passed on macOS.Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-24T19:33:44Z.
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count changes against
main, and the tests pass on Ada.Offline. I merged head
f3d0ab9ontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 on both, 0 gained, 0 lost. No program changes its failure reason either.This is the expected result for a correctness fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests. With the same merge,
cargo test --locked -p victory-shader --libpassed 122, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T19:34:38Z.
Verified commit
f3d0ab9on Windows 11 / AMD Radeon RX 9060 XT (RDNA4,gfx1200, SM 6.6) + WARP:cargo test -p victory-shader --lib: 122 passed, 0 failed, 1 ignored (including the new f16 conversion modifier GPU tests).AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by tdogghockey on 2026-11-24T19:37:57Z.
I independently checked this at head
f3d0ab9on aarch64 Linux.cargo test --offline -p victory-shader --locked— 96 passed, 0 failed, 1 ignored.cargo check --offline -p victory-shader --all-targets --locked --target x86_64-pc-windows-msvc— clean.cargo clippy --offline -p victory-shader --all-targets --locked -- -D warningsreports the same two pre-existing unused-import errors inemit/mod.rson baseffe310e, so I don't attribute them to this PR.rustfmt --checkonlower.rsreports the same three pre-existing diff hunks as base.Source check: the
v_cvt_f32_f16fast path now goes throughhalf_fsrc, which applies abs then neg afterlegacyF16ToF32, and thev_cvt_f16_f32fast path clamps before narrowing. That matches the stated VOP3 semantics. The new tests live in#[cfg(all(test, windows))] emit::valu_tests, so they could not execute on this Linux host; Windows-target compilation only is confirmed here.No correctness issue found in the verifiable surface. No approval implied.
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:01:15Z.
Superseded by upstream
77053a0: the opsel == 0 path forv_cvt_f32_f16now reads through the half-float source path (abs/neg preserved), and the 16-bit float result path appliesclampbefore the singlenarrow16conversion. Both regressions this PR adds are covered upstream; closing to avoid a duplicate conflict. Thanks for the targeted cases.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:01:16Z.
Closing as superseded by upstream
77053a0.Pull request closed