tombox-xshader: decode and translate the VOP3-encoded v_interp f32 forms #253

Closed
github-bot wants to merge 1 commit from gh-pr/253/head into gh-pr/253/base
Owner

@⁠azerioxfr on GitHub · 2026-11-23 07:54 UTC · original
azerioxfr:xshader-vop3-interp-forms → main · +101 −34 · 4 files · 1 commits · closed without merging

Library / area: tombox-xshader, pixel-shader attribute interpolation (rdna2 VOP3 decode, hlsl.rs interp lowering)

Exports changed (exports.txt rows): none

Source of the behaviour: opcodes from tests/isa_table/gfx1013.txt (VOP3 0x200, 0x201, 0x202). The VOP3-interp operand layout is attr in dword1[5:0], chan in [7:6], the f16 high bit in [8] and vsrc in [17:9]. Semantics are those of the VINTRP forms the translator already lowers.

One topic, +101 / -34: the existing Enc::Vinterp lowering moves unchanged into emit_interp, shared by both encodings.

What was missing

tests/isa_table.rs lists v_interp_p1_f32, v_interp_p2_f32 and v_interp_mov_f32 (VOP3) under "vop3: gfx1013 opcodes not named by the decoder", so a pixel shader that uses the VOP3 encoding failed translation.

The change

part change
decoder names VOP3 0x200..0x202 and decodes the interp operand layout instead of the generic src0/1/2 triple
lowering the same as the VINTRP forms (attribute resolved through ps_attrs)
modifiers abs, neg, clamp, omod, opsel and the f16 high bit are refused with an exact error, not dropped
f16 forms (0x342, 0x343, 0x35a) left unnamed. Their half selection is not established from the ISA text.

Tests (tests/synthetic.rs)

run result
pixel shader with one of each VOP3 form vs the same program in VINTRP encoding identical HLSL (apart from instruction-offset comments)
VOP3 v_interp_p1_f32 with neg refused with the exact message
mutation: chan forced to 0 / modifier check disabled the equality / refusal test fails
--test synthetic / opcodes / isa_table 26 / 26 / 3 passed

isa_table "vop3" unnamed count: 14 → 11.

  • cargo test -p tombox-xshader --test synthetic passes
  • No game or console files and no binaries included
  • No fake success; anything not possible is left missing with a note
**@⁠azerioxfr** on GitHub · 2026-11-23 07:54 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/253) `azerioxfr:xshader-vop3-interp-forms` → `main` · +101 −34 · 4 files · 1 commits · closed without merging **Library / area:** tombox-xshader, pixel-shader attribute interpolation (`rdna2` VOP3 decode, `hlsl.rs` interp lowering) **Exports changed (exports.txt rows):** none **Source of the behaviour:** opcodes from `tests/isa_table/gfx1013.txt` (VOP3 0x200, 0x201, 0x202). The VOP3-interp operand layout is attr in dword1[5:0], chan in [7:6], the f16 high bit in [8] and vsrc in [17:9]. Semantics are those of the VINTRP forms the translator already lowers. One topic, +101 / -34: the existing `Enc::Vinterp` lowering moves unchanged into `emit_interp`, shared by both encodings. ### What was missing `tests/isa_table.rs` lists `v_interp_p1_f32`, `v_interp_p2_f32` and `v_interp_mov_f32` (VOP3) under "vop3: gfx1013 opcodes not named by the decoder", so a pixel shader that uses the VOP3 encoding failed translation. ### The change | part | change | |---|---| | decoder | names VOP3 0x200..0x202 and decodes the interp operand layout instead of the generic src0/1/2 triple | | lowering | the same as the VINTRP forms (attribute resolved through `ps_attrs`) | | modifiers | abs, neg, clamp, omod, opsel and the f16 high bit are refused with an exact error, not dropped | | f16 forms (0x342, 0x343, 0x35a) | left unnamed. Their half selection is not established from the ISA text. | ### Tests (`tests/synthetic.rs`) | run | result | |---|---| | pixel shader with one of each VOP3 form vs the same program in VINTRP encoding | identical HLSL (apart from instruction-offset comments) | | VOP3 `v_interp_p1_f32` with neg | refused with the exact message | | mutation: chan forced to 0 / modifier check disabled | the equality / refusal test fails | | `--test synthetic` / `opcodes` / `isa_table` | 26 / 26 / 3 passed | isa_table "vop3" unnamed count: 14 → 11. - [x] `cargo test -p tombox-xshader --test synthetic` passes - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:15:58 +00:00
github-bot closed this pull request 2026-11-26 06:15:58 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 14:08 UTC · original

Applied locally on main with your authorship kept (cherry-picked, 19d0be4); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.

**@⁠omonkeyz** on GitHub · 2026-11-23 14:08 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/253#issuecomment-7103541371) Applied locally on main with your authorship kept (cherry-picked, 19d0be4); the tombox-xshader suite passes in a sandbox (exec 155/155 on WARP). It ships in the next release; this PR will be closed when that is pushed. Thanks.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:08 UTC · original

Applied on main in 19d0be4 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:08 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/253#issuecomment-7163354920) Applied on main in 19d0be4 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.