Skip to content

xshader: fix VOP3 operand handling in lower_first_lane_reads and mesh validate_launch - #288

Merged
brcly merged 3 commits into
brcly:mainfrom
smith-3:fix/xshader-vop3-s0-and-mesh-readlane
Nov 27, 2026
Merged

brcly merged 3 commits into
brcly:mainfrom
smith-3:fix/xshader-vop3-s0-and-mesh-readlane

Conversation

@smith-3

@smith-3 smith-3 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Two targeted fixes in tools/shader-compiler for cases where generic VOP3 decoding exposed unused or differently-typed register operands:

  1. lower_first_lane_reads (lanes.rs, pipeline.rs):
    • Exclude unused Sgpr(0) padding slots emitted by the generic VOP3 decoder for 1-operand VOP1 (0x180..0x200) and 2-operand VOPC/VOP2 (< 0x180, excluding 3-operand v_cndmask_b32 / carry-in ops) when checking whether lane is read between s_ff1_i32_b* and v_readlane_b32.
    • Run lower_first_lane_reads for all pixel shaders (not only root-less pixel shaders with a resource-heap base), since every pixel shader executes as a single-lane wave (exec_lo = 1u).
  2. validate_launch (mesh.rs):
    • Treat v_readlane_b32 destinations as Sgpr(n) rather than Vgpr(n) in writes(), matching RDNA2 semantics where v_readlane_b32 writes a scalar register despite the generic VOP3 decoder storing it in Opnd::Vgpr. This prevents false rejections when a mesh shader reads a lane into an SGPR whose index matches lane_index.

Verification

  • Added unit tests:
    • lower_first_lane_reads_ignores_unused_vop3_s0_padding in tools/shader-compiler/src/tests/hlsl.rs
    • validate_launch_ignores_readlane_sgpr_destination_matching_lane_vgpr in tools/shader-compiler/src/tests/hlsl/mesh.rs
  • Ran cargo test for tuxbox-dxbc (21/21 passed) and tuxbox-xshader (400/400 passed).

Copilot AI balanced review requested due to automatic review settings November 27, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@brcly
brcly merged commit d8c4327 into brcly:main Nov 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants