Skip to content

Recompiler: handle packed ISG1 vertex inputs sharing a register (#105) - #313

Draft
Michael-Glaser wants to merge 1 commit into
ivall:mainfrom
Michael-Glaser:fix/recomp-vertex-packed-isg1
Draft

Michael-Glaser wants to merge 1 commit into
ivall:mainfrom
Michael-Glaser:fix/recomp-vertex-packed-isg1

Conversation

@Michael-Glaser

@Michael-Glaser Michael-Glaser commented Nov 23, 2026 •

Copy link
Copy Markdown

Part of #105. Mode::Vertex named XclIn fields a{e.register} and ignored e.mask, emitting duplicate field names and reading wrong channels when two ISG1 inputs share a register. Overlaps #297 (same packed-ISG1 issue, different approach).

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: name XclIn fields a{k} by index (matching Mode::Pixel) and map VGPR channels using e.mask.
  • crates/xcl/src/gpu/recomp/tests.rs: unit test vertex_packed_isg1_inputs_get_distinct_fields_and_components.

Tested

  • Cross-checked on macOS (aarch64-apple-darwin, Rust 1.100.0): cargo check --offline --target x86_64-pc-windows-msvc --workspace --tests (0 errors, 0 new warnings).

Not tested

  • Not built or executed on Windows; DXC, cargo test, GPU tests, and scripts/smoke.ps1 not run yet.

AI use

  • Antigravity with Gemini 4 Neon (audit, fix, unit test, description).

@regiumlepidi

Copy link
Copy Markdown

A Windows run for this draft, and a note that #297 (draft) fixes the same packed-ISG1 case in another way; the two conflict in emit.rs.

This PR: 18ca3b6 merged onto current main db1ddb2 (clean merge) builds and passes on both adapters: 667 passed, 0 failed, 41 ignored on an RTX 5070 Ti (driver 617.42) and on the Ryzen 7 9800X3D's RDNA2 iGPU (driver 32.0.21030.2001, XCL_ADAPTER=radeon); main alone is 666 / 0 / 41 on both. vertex_packed_isg1_inputs_get_distinct_fields_and_components fails with main's emit.rs and passes with this PR's. Windows 11 Pro 25H2, Ryzen 7 9800X3D, rustc 1.100.0 MSVC, DXC from Windows SDK 10.0.26100, debug, no XCL_SAMPLE_*.

Cross-check with #297 (a5b7825; #297 does not merge with main db1ddb2 any more, so each PR at its own head, on 9ab7d76). Each PR's tests appended to the other's tests.rs, both adapters, same result on each:

Fix #297's gpu_vs_packed_isg1_inputs (draws on the GPU) #297's vs_packed_isg1_inputs_are_members_of_their_own (HLSL text) #313's vertex_packed_isg1_inputs_get_distinct_fields_and_components (HLSL text)
main fails fails fails
#297 pass pass fails: its members are float2 a1_0 / float2 a1_2, not float4 a1 / a2
#313 pass fails: no a1_0 member pass

So on the one test that draws (packed TEXCOORD0 .xy / TEXCOORD1 .zw through an R32G32 input layout), both fixes give the expected pixels on NVIDIA and on RDNA2; the failing cross cases only assert the other PR's member names. Both read a component no element covers as 0u, and both keep an element alone in its register as float4 a…. The difference that is left: #313 declares every packed element as a 4-vector starting at component 0 and indexes by the bits of its mask, #297 declares each with its own width.

Not tested: scripts/smoke.ps1 on a real title (I have none); RDNA3 / RDNA4, Intel.

AI use: Claude Code with Claude Opus 5.5 ran the builds and the cross-check and wrote this comment; the numbers come from those runs.

…l#105)

In Mode::Vertex, struct XclIn named fields a{e.register} and VGPR initialisation looked up the first element matching e.register while ignoring e.mask. When two ISG1 vertex inputs pack into one register (e.g. TEXCOORD0 .xy and TEXCOORD1 .zw in register 1), XclIn emitted duplicate field names (failing DXC compilation) and upper channels read from the first element instead of the packed element's components.

Name XclIn fields by element index (a{k}, matching Mode::Pixel) and match each VGPR channel against e.mask, indexing the packed element starting from component 0 while keeping the unmasked fallback for single elements that rely on IA defaults.

Assisted-by: Antigravity (Gemini 4 Neon)
@Michael-Glaser
Michael-Glaser force-pushed the fix/recomp-vertex-packed-isg1 branch from 18ca3b6 to 3875b45 Compare November 24, 2026 00:16
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.

2 participants