tombox-xshader: translate the RDNA2 VOP3P packed 16-bit integer ops #198
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!198
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/198/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?
@GDAgent on GitHub · 2026-11-23 00:55 UTC · original
GDAgent:fix/xshader-vop3p-int16→main· +150 −13 · 4 files · 1 commits · closed without mergingLibrary / area:
tombox-xshader(rdna2VOP3P decoder names,hlsl.rspacked integer ops,tests/opcodes.rs,isa_sweep)Exports changed (exports.txt rows): none
Source of the behaviour: RDNA2 ISA: VOP3P opcode table (section 12.10) for opcodes 0x00-0x0d, OPSEL/OPSEL_HI source-half selection, and CLAMP saturation for packed integer add/sub (section 6.5).
The decoder named only the two packed shifts among the VOP3P integer opcodes, so
v_pk_add_u16(0x0a) and the rest of the family were refused asunsupported vector op [vop3<0x40a>]. The Matrix Awakens hits this in a compute shader (v_pk_add_u16 v5, v5, -1followed byv_pk_mul_lo_u16), and the failed compute PSO is fatal for it.Changes:
v_pk_mad_i16/u16,v_pk_mul_lo_u16,v_pk_add/sub_i16/u16,v_pk_lshlrev/lshrrev_b16,v_pk_ashrrev_i16,v_pk_max/min_i16/u16. OPSEL/OPSEL_HI pick the source halves for each result half; signed ops sign-extend each half; shift counts are the low 4 bits of the selected source-0 half.Tests:
tests/opcodes.rs: decoder names and a DXC compile for all 14 ops, and the refusal checks.isa_sweepcases against a reference model: four OPSEL/CLAMP variants per op plus the title's inline-1form (WARP).cargo test -p tombox-xshader --no-fail-faston currentmain: 293 passed, 0 failed (WARP).Not verified in a title: in The Matrix Awakens the compute shader that was refused before (
vop3<0x40a>, PSO creationE_FAIL) now translates and compiles, and a later run logged no translation failures. Whether that shader's output is correct in the title was not checked; the packed-op results themselves are checked against the reference model on WARP, not on console hardware.cargo test -p tombox-xshaderpassesmissingwith a note@omonkeyz on GitHub · 2026-11-23 01:38 UTC · original
Applied in
54db2e3(merged in24e6c10) with your authorship kept, thanks. It conflicted with #202, since both add helpers after sat_int; I resolved it by keeping both.Pull request closed