Fix integer vertex selection in v_interp_mov_f32 #291

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

@⁠NemesisDawn on GitHub · 2026-11-23 15:40 UTC · original
NemesisDawn:vinterp-integer-vertices → main · +68 −2 · 3 files · 1 commits · closed without merging

Honors the vertex selector in v_interp_mov_f32 for flat integer inputs.
Adds a synthetic triangle test that reads a distinct value from each
of the three vertices.

The new test passed on Windows using both an RTX 5080 and WARP.
Validation covers the translated Direct3D 12 shader.

Refs #187.

**@⁠NemesisDawn** on GitHub · 2026-11-23 15:40 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/291) `NemesisDawn:vinterp-integer-vertices` → `main` · +68 −2 · 3 files · 1 commits · closed without merging Honors the vertex selector in v_interp_mov_f32 for flat integer inputs. Adds a synthetic triangle test that reads a distinct value from each of the three vertices. The new test passed on Windows using both an RTX 5080 and WARP. Validation covers the translated Direct3D 12 shader. Refs #187.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:17:32 +00:00
github-bot closed this pull request 2026-11-26 06:17:32 +00:00
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 18:07 UTC · original

Heads-up on how this interacts with #253 (VOP3-encoded v_interp, applied locally per the thread there). ins.op is not normalized between encodings: rdna2.rs:500 gives (w >> 16) & 0x3 for VINTRP, so v_interp_mov_f32 is op == 2, but rdna2.rs:496 gives (w >> 16) & 0x3ff for VOP3, so its VOP3 form is op == 0x202. #253 routes the VOP3 forms through emit_interp. Once both are in, the ins.op == 2 test here is false for the VOP3 form, which would keep reading i.iN.x instead of GetAttributeAtVertex.

Minimal fix: (ins.enc == Enc::Vinterp && ins.op == 2) || (ins.enc == Enc::Vop3 && ins.op == 0x202). Also, #253 decodes the VOP3 source with src9, which only yields Opnd::Vgpr for codes >= 256, so [Opnd::Vgpr(selector)] may need to accept the VOP3 operand form too. A VOP3 variant of integer_vertex_selectors_read_the_requested_vertex would cover both. I have not run the merged code; this is from reading both diffs.

**@⁠QuentinDanblon** on GitHub · 2026-11-23 18:07 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/291#issuecomment-7109698000) Heads-up on how this interacts with #253 (VOP3-encoded v_interp, applied locally per the thread there). `ins.op` is not normalized between encodings: `rdna2.rs:500` gives `(w >> 16) & 0x3` for VINTRP, so v_interp_mov_f32 is `op == 2`, but `rdna2.rs:496` gives `(w >> 16) & 0x3ff` for VOP3, so its VOP3 form is `op == 0x202`. #253 routes the VOP3 forms through `emit_interp`. Once both are in, the `ins.op == 2` test here is false for the VOP3 form, which would keep reading `i.iN.x` instead of `GetAttributeAtVertex`. Minimal fix: `(ins.enc == Enc::Vinterp && ins.op == 2) || (ins.enc == Enc::Vop3 && ins.op == 0x202)`. Also, #253 decodes the VOP3 source with `src9`, which only yields `Opnd::Vgpr` for codes >= 256, so `[Opnd::Vgpr(selector)]` may need to accept the VOP3 operand form too. A VOP3 variant of `integer_vertex_selectors_read_the_requested_vertex` would cover both. I have not run the merged code; this is from reading both diffs.
Author
Owner

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

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

**@⁠omonkeyz** on GitHub · 2026-11-25 13:48 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/291#issuecomment-7164325183) Applied on main in d38321c (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.