Shaders: honor op_sel, omod and clamp on v_interp_p2_f16 (port of VIctory#1696) #189
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/Belobug--VIctory-Belobug-AMD!189
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-189"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:25 UTC · original
lcg007xd-c:port/vic-1696→main· +141 −1 · 2 files · 1 commits · openPort of Marvisak/VIctory#1696 by Calvix2k. It is cherry-picked with
-x, so the commit keeps its author and its upstream hash. This fork'smain(000ffdd) does not have it, and it is not in #142.What it fixes
v_interp_p2_f16ignoredop_sel(which half it writes),omodandclamp. The fork keeps 16-bit inputs as f32, so here omod and clamp are applied to the f32 value before its single conversion to f16, and the result goes throughwrite_half.Tested (Linux, Rust 1.98.1)
interpolated_f16_writes_the_op_sel_half_with_modifiers(adapted to the fork'strack/emitsignatures; needs dxc, so Windows). On Linux, a temporary IR test showed no high-half shift without the port; not committed. Upstream's test-formatting hunks for tests this fork does not have were left out.cargo test -p victory-shader --libon this branch alone: no failures.mainwithout conflicts, and does not depend on the other open ports.Not run here: Windows/GPU tests, since I have no Windows machine.
🤖 Generated with Claude Code
@MamaLeVrai on GitHub · 2026-11-26 04:57 UTC · original
Heads-up from a merge test: this PR's new test passes on its own head but fails once merged with current
main.2376b13(base000ffdd):interpolated_f16_writes_the_op_sel_half_with_modifierspasses.main4f62c2a: it fails in every run (2 of 2) withvictory-shadercommits between the two bases. Merged ontoe48eb83it passes; merged ontoae75a66("Clean-up passes over translated shaders") it fails. So the clean-up passes change what this test sees: either they drop or merge the write that keeps the high half, or the test reads the program at a point that the passes now reshape. I have not looked at which.The rest of
victory-shaderis unchanged by the merge: 275 passed, 3 failed. The two other failures are the RDNA2 wave-size tests that fail onmaintoo (#110, #204). Command:cargo test --release -p victory-shader --lib, on an RX 6950 XT, Windows 11 build 26300, Rust 1.98.1. The test itself does not use the GPU.AI-assisted (Claude Code); no game data.
@adrianmjim on GitHub · 2026-11-26 19:44 UTC · original
Tested on Windows 11 with Rust 1.98.1 and dxc/dxil.dll from SDK 10.0.26100.0. Nothing below used the GPU. The head
2376b13is based on000ffdd. I cherry-picked it onto current main4f62c2a, where it applies cleanly, and tested that. Main now runs the bitcode clean-up passes by default.New test (
interpolated_f16_writes_the_op_sel_half_with_modifiers):4f62c2a+ this PR: fails atassert!(low.contains("-65536"), "low write keeps the high half"). In this test the translator uses the constant 0 for the old v2. The mask becomesand i32 0, -65536, and the clean-up passes fold it away. WithVICTORY_SHADER_OPT=0the test passes.shl i32 ..., 16,fmul ... 2.000000e+00anddx.op.unary.f32(i32 7, ...), and the low dump has no saturate. So only the -65536 assertion depends on the passes. A non-constant kept half, or a check that survives the passes, should make the test pass on main.4f62c2a): withVICTORY_SHADER_OPT=0it fails at "op_sel[3] writes the high half", as intended. With the default passes it fails earlier, at the -65536 assertion.Whole-title run of the game's shaders.rpf (
translate --validate --host-lanes 32-64),4f62c2aagainst4f62c2a+ PR:dxc -dumpbin. Each has the same set of instructions and the same instruction count as before. This fits the code:write_halfemits its twoands in the opposite order fromlow_half.v_interp_p2_f16, and none of them sets op_sel[3], clamp or omod. So the fixed paths are not used in this game.Not tested:
000ffdd).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.