tombox-xshader: decode the VOP3 v_interp f16 forms and refuse them with attr/chan/half #304
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!304
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/304/head"
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?
@enderrr9 on GitHub · 2026-11-23 17:13 UTC · original
enderrr9:xshader-f16-interp-decode→main· +172 −34 · 5 files · 2 commits · closed without mergingLibrary / area:
tombox-xshader(rdna2.rsdecode,rdna2/mnem.rsnames,hlsl.rsinterp refusal,bin/xshader.rsdisplay); tests intests/synthetic.rs.Exports changed (exports.txt rows): None.
Source of the behaviour: opcodes from
tests/isa_table/gfx1013.txt(VOP3 0x342v_interp_p1ll_f16, 0x343v_interp_p1lv_f16, 0x35av_interp_p2_f16). The operand layout is the VOP3-interp layout from #253: attr in dword1[5:0], chan in [7:6], the high bit in [8], the I/J VGPR in the src1 field, and (p1lv, p2) the second operand in the src2 field. Semantics come from the RDNA2 ISA text.Builds on #253 (azerioxfr, applied by the maintainer as
19d0be4, not onmainyet). This branch contains #253's commit unchanged (c67b619). Only the top commit is new.Why refuse instead of lowering
#253 left these three opcodes unnamed because their half selection isn't settled by the ISA text. This PR keeps that position and only makes it precise.
The RDNA2 ISA says the high bit selects the high or low 16 bits of the LDS attribute dword. It does not say which signature component the console compiler packs into each half. Two plausible layouts read different components for every channel past the first:
A lowering that guessed wrong would read the wrong input without any error. So all three forms are still refused, now with the exact fields:
v_interp_p1ll_f16 attr0.y high half: the packing of 16-bit attributes into LDS dword halves is not establishedIn the #289 sweep of a title without RTS0,
v_interp_p1ll_f16is the first refusal for 1,595 shaders. With this message, anxscanrun over a title shows which (chan, half) pairs occur and whether the high half is used at all. Together with the input signature's read mask, that is the evidence a real lowering needs. That lowering can then reuseemit_interp.Change
mnem.rs: names 0x342, 0x343 and 0x35a. Before, they disassembled as unknown VOP3 opcodes. Theisa_tabletest checks the names against gfx1013.rdna2.rs: decodes them like the f32 VOP3 forms (aux.imm= attr,aux.imm2= chan). Sources: the I/J VGPR, plus src2 for p1lv and p2.hlsl.rs: routes them throughemit_interp. They are refused outside a pixel shader as before, and refused in a pixel shader with the message above.xshader: shows[attrN.c](plushigh) for every VOP3 interp form, including #253's f32 forms.Tests
vop3_interp_f16_forms_decode_attr_chan_and_operands: the mnemonic, length, dst, sources, attr and chan for all three opcodes.vop3_interp_f16_forms_are_refused_with_attr_chan_and_half: low and high half, all four channels, and the exact error.cargo test --locked -p tombox-xshader --lib --binsplus every integration test exceptexec(CPU, noTOMBOX_EXEC_HW, Windows 11): 0 failed.exec.rs(WARP execution) was not run. This change only adds a refusal for opcodes that noexectest uses (no 0x342/0x343/0x35a in it).pr_gate.pyfrom the merge base: 5 files checked, 0 problems.Not verified in a title
I don't have a title dump, so the refusal counts above come from #289's sweep, not from a run of this branch.
cargo test -p tombox-xshaderpasses (all butexec.rs, see above)missingwith a note🤖 Generated with Claude Code
The `--test isa_table -- --nocapture` vop3 line listed v_interp_p1_f32 (0x200), v_interp_p2_f32 (0x201) and v_interp_mov_f32 (0x202) among the gfx1013 opcodes the decoder does not name. The VINTRP-encoded forms already decode and lower through Enc::Vinterp, so a title that emits the VOP3 forms (a VOP3-interp dword1 holds {high, chan, attr} in the src0 field and the vsrc VGPR in the src1 field) failed to translate. Name the three opcodes, decode the interp operand layout instead of the generic VOP3 src0/1/2 triple (attr d1[5:0], chan d1[7:6], vsrc d1[17:9]), and route them to the VINTRP lowering, which resolves the attribute through ps_attrs. The VOP3 forms carry abs (d0 bit 9), neg (d1 bit 30), clamp (d0 bit 15), omod (d1[28:27]), opsel (d0[14:11]) and the f16 high bit (d1 bit 8); the f32 forms are refused with an exact Err when any of these is set rather than dropping them silently. The f16 forms (0x342, 0x343, 0x35a) stay unnamed: their low/high half selection is not unambiguous here. Tests (tests/synthetic.rs): a PS with one of each VOP3 form produces the same HLSL as the VINTRP program (only the instruction-offset comments differ), and a neg-modified VOP3 p1 is refused with the exact message. Mutation: forcing chan to 0 fails the equality test; disabling the modifier check fails the refusal test; both restored. isa_table vop3 unnamed: 14 -> 11.@omonkeyz on GitHub · 2026-11-25 13:49 UTC · original
Applied on main in
accb803(cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.Pull request closed