Repository navigation
Shaders: lower VOP3 integer clamp saturation for add/sub ops - #1478
geiyiliyabumo wants to merge 1 commit into
Conversation
|
Independent NVIDIA hardware run. No game files were used. Machine: Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1, DXC Applied on main (
Not tested: the in-game effect; AMD. |
|
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at #1398 covers the same VIC-BT-010 item, so I ran each PR's tests against the other PR's code (tests copied in, everything else unchanged):
So the two agree on every value both produce on this hardware. Each one covers something the other doesn't: this PR adds signed |
|
Native Windows run on AMD RDNA2: RX 6750 XT (RDNA2, gfx1031), AMD driver 32.0.21045.29003, i5-13400F, Windows 11, Rust 1.98.1 MSVC. Head 1905213 on main ffe310e (clean merge).
Synthetic tests only, no game files. AI-assisted (Claude picked the PRs and wrote the batch script; I ran it on my machine). |
catminou4
left a comment
There was a problem hiding this comment.
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.
This subsumes the unsigned half of #1398 (already approved) and goes further — carry-out variants (v_add_co_u32 etc.) clamp via select(carry, limit, r) with the carry-out itself preserved, and the _i32 clamp path attempts signed overflow detection. Three things before merge:
- Overlap: #1398 touches the same
write_i/nc-op hunks plus aresource.rschange (|| f.clampin the plain-move bail-out) that this PR does not have. If both are needed, whichever lands second must reconcile; if #1398 lands first this will conflict textually. - Signed clamp is untested: both new valu tests are
vop3_unsigned_*; the_i32overflow formula (decreases XOR decreased, limit by sign ofa) has no hardware case. The unsigned saturation semantics are well covered (carry/borrow preservation across 6 opcodes × clamp on/off), but please add at least one signed clamp case — the formula is subtle enough that I'd want RDNA2 evidence. v_add3_u32correctly noted as having no clamp modifier on GFX10.3.
macOS: 96 passed, merge clean.
Offline measurement on a retail dump, and the shader tests on AdaResult: no count change against Offline. I merged head 1905213 onto No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on Tests: with the same merge, No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Thanks @catminou4 for the macOS verification and review! Just a quick note on point #2: commit AI-assisted; synthetic tests only, no game files. |
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1398. clamp on VOP3 integer add/sub. The unsigned carry and no-carry code is the same as in #1398 (identical lines), which also guards descriptor tracing; the extra signed v_add_nc_i32/v_sub_nc_i32 are also in #92. Neither is used by the title. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Summary
Implements VOP3 integer \clamp\ saturation for RDNA2 / GFX10.3 integer add/sub instructions in \�ictory-shader\ (tracking issue #1242, \VIC-BT-010).
Previously, \Lower::write_i\ rejected any integer VALU instruction with \�.clamp, refusing valid clamped integer add/sub instructions emitted by console shaders.
Changes