Skip to content

Recompiler: preserve interleaved packed VS input components - #309

Draft
likecrank-dotcom wants to merge 2 commits into
ivall:mainfrom
likecrank-dotcom:fix/packed-input-component-masks
Draft

likecrank-dotcom wants to merge 2 commits into
ivall:mainfrom
likecrank-dotcom:fix/packed-input-component-masks

Conversation

@likecrank-dotcom

Copy link
Copy Markdown

Stacked on #297. Only the top commit (a039d33) is mine; the first commit is #297's packed-input implementation by TG0000, replayed onto current main without its older documentation/workflow ancestry.

With TEXCOORD0.xz and TEXCOORD1.y sharing r1, selecting an input by its first-to-last component span makes TEXCOORD0 shadow TEXCOORD1.y. A synthetic GPU draw produces [0.25, -0.4, 0.75, 0] instead of [0.25, 0.5, 0.75, 0]. Select packed fields by their actual component mask. Inputs alone in their register retain the existing four-component behavior.

What is in it

Tested

  • Ryzen 5 3600, RTX 5060 Ti, NVIDIA 621.14 / 32.0.16.2114, 32 GB RAM; Windows 11 Pro 10.0.26300; Rust 1.100.0 MSVC, MSVC 19.44, SDK 10.0.26100.0, DXC 1.9.2602.17; debug.
  • Recompiler: VS inputs packed into one ISG1 register are members of their own (#105) #297 head a5b7825: cargo build --workspace and cargo test --workspace -- --test-threads=4 --nocapture: 653 passed, 0 failed, 40 ignored.
  • The added interleaved-mask GPU test on that head without this fix: 1 failed, exit 101, wrong pixel value as above. With this fix: 1 passed, exit 0.
  • Clean head a039d336837920a2bdbf028ff207b4cab3181916: cargo build --workspace, then cargo test --workspace -- --test-threads=4 --nocapture: exit 0; 654 passed, 0 failed, 40 ignored (lib: 614/0/20), including the synthetic-title end-to-end test. git diff --check passes.
  • Four explicit skips: two no-wave64 tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware), test_title_draws_with_a_root_signature_under_the_debug_layer (no d3d12SDKLayers.dll), and uploads_start_from_each_subresources_state (no D3D12 debug layer).

Regression run
Not run on a retail title. This is a draft pending the real-title main/head smoke runs required by CONTRIBUTING.md.

Not tested

  • No retail title or game-data samples; no claim that a particular title uses interleaved masks or that gameplay improves.
  • AMD, Intel, wave64, Wine, and debug-layer validation.
  • The separate zero-mask edge case is not addressed.

AI use
Codex reproduced the GPU failure, wrote the fix and adapted regression, ran the commands, and prepared this description. The exact deployed model identifier is not exposed in this session. No claim of human code review is made.

TG0000 and others added 2 commits November 24, 2026 01:02
…eir own (ivall#105)

A console vertex shader whose input signature packs two elements into one register
(TEXCOORD0 in .xy and TEXCOORD1 in .zw of r1) declared `float4 a1` once per element in
`XclIn`: a member declared twice, which DXC rejects (duplicate member 'a1'), so the
pipeline had no VS. Each packed element now gets its own member, `a{register}_{first}`,
with the components of its mask; the fetch-shader VGPRs v[b + c] read the element that
covers component c (TEXCOORD1.x in the register's z), and a component no element covers
reads 0. An element alone in its register keeps `a{register}` as a 4-vector, so the HLSL
of every other shader is unchanged.

Tests: vs_packed_isg1_inputs_are_members_of_their_own (HLSL, DXC compile) and
gpu_vs_packed_isg1_inputs (draw on the GPU with an input layout of separate R32G32
elements).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Select a packed attribute by its actual component mask so TEXCOORD0.xz cannot shadow TEXCOORD1.y. Preserve all four components for unshared input registers. Add a GPU regression adapted from the packed-input test in ivall#297.

Assisted-by: Codex (exact model identifier unavailable)
@AC-Storm-YT

Copy link
Copy Markdown

Test run on AMD RDNA4 – commit a039d33 (this PR's head, as is, not merged with main, which it currently conflicts with), clean tree

Tested

  • AMD Radeon RX 9070 XT (RDNA4, wave64), driver 32.0.32029.2010 – the tests ran on it (backend 'real' – AMD Radeon RX 9070 XT); AMD Ryzen 7 9800X3D; Windows 11 Pro build 26200; Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug; DXC 1.8.2502.11
  • cargo build --workspace: ok
  • cargo test --workspace -- --test-threads=4: 654 passed, 0 failed, 40 ignored. No SKIPPED tests.
  • The new tests pass: gpu_vs_packed_isg1_inputs, gpu_vs_interleaved_isg1_input_masks (GPU), vs_packed_isg1_inputs_are_members_of_their_own

Not tested

  • No retail title or smoke.ps1 run
  • Release build; the commit after it is rebased onto current main

AI use: run and report by Claude Code (Claude Opus 5.5).

@nullmarsh

Copy link
Copy Markdown

Adding a negative control to AC-Storm-YT's RDNA4 run above, on a second RDNA4 card (RX 9060 XT, driver 32.0.32029.2010, Windows 11 26200, Rust 1.100.0, debug):

  • Head a039d33, XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib isg1: 4 passed.
  • Recompiler: VS inputs packed into one ISG1 register are members of their own (#105) #297's commit cecd16f with this PR's tests.rs: gpu_vs_interleaved_isg1_input_masks fails with pixel (0,0) = [0.25, -0.4, 0.75, 0.0], expected [0.25, 0.5, 0.75, 0.0], the same value as your NVIDIA run. So the test catches the TEXCOORD0 shadowing on AMD too. The other three pass.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.

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.

4 participants