Shaders: decode the VOP3 interpolation forms (attr63.w is no literal) #70
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/uiliannn--VItoriaBr!70
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-70"
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 21:34 UTC · original
lcg007xd-c:fix/vop3-interp-decode→main· +83 −2 · 5 files · 2 commits · openWhat
The VOP3 interpolation instructions put an attribute and its channel in the first source field, not an operand code. That covers
v_interp_p1ll_f16,v_interp_p1lv_f16,v_interp_p2_f16, and the 64-bit encodings ofv_interp_p1/p2/mov_f32.attr63.wencodes as0xFF, and the decoder's length rule read that as "a 32-bit literal follows". The instruction then swallowed the next dword, and everything after it decoded out of step.llvm-mcreads all of them as two dwords. For these opcodes, the first source no longer counts toward a literal.VOP3 0x200–0x202 also get their names:
v_interp_p1_f32,v_interp_p2_f32andv_interp_mov_f32, LLVM's_e64forms. Before, they decoded with no name. Each takes two sources, andv_interp_mov_f32's parameter prints asp10/p20/p0, as in VINTRP. The input pass only understands the VINTRP pair, so translation refuses these VOP3 forms with an error instead of misreading them. A test pins that.Upstream has an open PR for the same length bug (Marvisak/VIctory#2515). This is an independent fix on VItoriaBr's decoder.
Tests
vop3_interpolation_attributes_are_not_literalschecks six encodings fromllvm-mc -triple=amdgcn -mcpu=gfx1030: the three f32_e64forms withattr31.w, and the three f16 forms withattr63.w. Each must decode as one two-dword instruction with LLVM's operands (without the_e64suffix). With the length change reverted, the test fails.vop3_encoded_f32_interpolation_is_refusedchecks that a VOP3-encoded p1/p2 pair decodes with its names and thatio::raiserefuses it.--target x86_64-pc-windows-msvc) pass locally.Not tested: Windows runtime, GPU, and the game. Real shaders have fewer than 33 attributes, so
attr63.wshould not appear in practice. The length bug matters for disassembly and for decoding data or garbage as code.Note: the Windows
checkjob fails on current main for an unrelated reason (5668b8b, missingLayout::bytes_from), which #64 fixes.🤖 Generated with Claude Code
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.