Recompiler: VS inputs packed into one ISG1 register are members of their own (#105) #294
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/297"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by TG0000 on 2026-11-23T22:39:52Z.
Part of #105 (item 4, "packed
ISG1vertex inputs sharing a register emit duplicateXclInfield names (a{e.register}) inMode::Vertex").A console vertex shader can have two input elements packed into one register, for example TEXCOORD0 in
.xyand TEXCOORD1 in.zwof r1.Mode::Vertexdeclaredfloat4 a1once per element, soXclInhad the same member twice. DXC rejects that (error: duplicate member 'a1'), so the pipeline ended up with no VS. Now each packed element gets its own member,a{register}_{first}, sized to the components in its mask. Fetch-shader VGPRv[b + c]reads the element that covers componentc, so TEXCOORD1.x lands in the register's z, as on the console. A component that no element covers reads0u. An element alone in its register keepsfloat4 a{register}, so every other shader's HLSL stays the same.The other leftovers of #105 are covered elsewhere: items 1 and 4 by #134 and #202, item 2 by #117 and #149 (merged), item 3 by #123 (merged). The Geometry-mode
xcl_vinnote in item 3 is by design in #215, which puts the pre-fetched GS vertices in window 0.What is in it
crates/xcl/src/gpu/recomp/emit.rs:vs_input_fields/VsInputFieldname theXclInmembers and the component range each one covers. TheMode::Vertexstruct and the VGPR initialisers use them.crates/xcl/src/gpu/recomp/tests.rs:vs_packed_isg1_inputs_are_members_of_their_own: checks the HLSL members and VGPR reads (masks0x3+0xC, and0x3+0x4where.wis uncovered) and compiles both with DXC.gpu_vs_packed_isg1_inputs: draws on the GPU with an input layout of three separateR32G32_FLOATelements. Every pixel must be (TEXCOORD0.xy, TEXCOORD1.xy).Tested
stable-x86_64-pc-windows-gnuwith llvm-mingw clang), debug, DXC 1.9.2609.5 (dxcompiler + dxil from the GitHub release).origin/main'semit.rs): both new tests FAIL.gpu_vs_packed_isg1_inputspanics withdxc: hlsl.hlsl:466:12: error: duplicate member 'a1'.vs_packed_isg1_inputs_are_members_of_their_own,gpu_vs_packed_isg1_inputs,gpu_graphics_vs_ps_drawandvs_system_values_in_isg1_registerspass on the RX 6800.cargo test --workspace --exclude testgame-mw --no-fail-fast -- --test-threads=4: 651 passed, 2 failed, 40 ignored, noSKIPPEDGPU tests. Both failures also fail on unmodifiedmainwith this toolchain:pe::tests::parses_own_test_binary_tls: the gnu/llvm-mingw test binary has no TLS directory.e2e::test_title_runs_and_game_folder_is_untouched: it needstestgame_mw.dll, andtestgame-mwis excluded because it doesn't build with this toolchain.cargo clippy -p xcl --all-targets: no warnings on the added lines.Regression run
Windows 11, Ryzen 9 5900X, AMD Radeon RX 6800, Rust stable
x86_64-pc-windows-msvc(VS 2022 Build Tools, link.exe),cargo build --release -p xcl,scripts/smoke.ps1 -Seconds 45, one run at a time under a RAM watchdog.main (
a6f5f7a, currentorigin/main, this PR's base):PR (head commit, no local changes):
No regression: 728 frames against 828 on its base, no device removals or crashes, peak commit 15154 MB against 15144 MB. Frame counts move by about 10 % between runs of the same commit on this machine (earlier runs of
maingave 843, 709 and 828).Rebased onto current
main(a6f5f7a): the one conflict, ingpu/recomp/tests.rs, is resolved by keeping both tests. On the rebased head, built withstable-x86_64-pc-windows-msvc,cargo test -p xcl --lib recomppasses: 184 passed, 0 failed, 18 ignored, includingvs_packed_isg1_inputs_are_members_of_their_ownandgpu_vs_packed_isg1_inputson the RX 6800.Not tested
runner::options, which picks it on such adapters).AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-23T22:52:44Z.
Independent static code audit of
a5b78258d(code inspection only —cargo testnot run on macOS; no game files):Summary: Looks clean
.xy+.zw, single-component.z, etc.), emittinga{register}_{first}sized tocount = 32 - mask.leading_zeros() - firstavoids duplicateXclInmember names and maps fetch-shader VGPRsinput_vgpr + ctoxi.a{reg}_{first}[c - first], leaving uncovered components0u.Minor defensive edge cases (
emit.rs:vs_input_fields)0b0101and0b0010),first..first + countspans the gap and could shadow the second element infind_map. Checking(f.elem.mask >> c) & 1 != 0prevents misattribution.mask == 0,.max(1)forcesfirst = 0on both, recreating a duplicatea{reg}_0member name.(AI-assisted)
Imported from ivall/xcl. Originally posted by likecrank-dotcom on 2026-11-23T23:05:38Z.
Independent native Windows/MSVC + NVIDIA validation at
a5b78258dad506fdb60e377bcecdccd7f754514a.Tested
cargo build --workspace: exit 0.cargo test --workspace -- --test-threads=4 --nocapture: 653 passed, 0 failed, 40 ignored (lib: 613/0/20). Both new packed-input tests,parses_own_test_binary_tls, and the synthetic-title end-to-end test pass on MSVC/NVIDIA.main@0e946cfwith unchanged runtime:cargo test -p xcl --lib packed_isg1_inputs -- --nocapture --test-threads=1: 0 passed, 2 failed, exit 101. GPU case reports DXCduplicate member 'a1'; the source-structure case fails its new-member assertion.Additional measured interleaved-mask case and fix
With TEXCOORD0.xz (mask 0x5) and TEXCOORD1.y (mask 0x2) sharing r1, a synthetic GPU draw adapted from this PR's test produced pixel
[0.25, -0.4, 0.75, 0]instead of[0.25, 0.5, 0.75, 0]on this head (1 failed, exit 101). Selecting a field by its actual component mask instead of its first-to-last span fixes the draw (1 passed, exit 0). Unshared register inputs still retain all four components.The fix and GPU regression are in #309, stacked on this PR; your implementation and authorship are preserved in the first commit. Its clean head
a039d336837920a2bdbf028ff207b4cab3181916passes the whole suite: 654 passed, 0 failed, 40 ignored. Draft pending retail regression runs. No claim that a retail shader uses this synthetic layout.SKIPPED / Not tested
Four explicit skips in both full suites:
gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64);test_title_draws_with_a_root_signature_under_the_debug_layer(no d3d12SDKLayers.dll);uploads_start_from_each_subresources_state(no D3D12 debug layer). No XCL_SAMPLE variables, retail title/smoke run, AMD/Intel/Wine or debug-layer verification. The zero-mask edge case remains outside this fix. The existingfetch_updatedeprecation warning remains.AI use
Codex ran the commands, adapted the synthetic GPU regression, wrote the follow-up fix and summarized actual logs. Exact deployed model identifier is not exposed in this session.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T00:26:04Z.
Tested
cargo build --locked --workspacepassed.cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --nocaptureexited 0. Cargo reported 678 passed, 0 failed and 41 ignored.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardwarerequire wave64.test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_staterequire the D3D12 debug layer.packed_isg1_inputsrun also passed both tests with zero skips.Not tested
AMD and retail titles on this machine. The author reports separate RX 6800 tests and retail smoke results at the same head. Author’s results
AI use
Codex with GPT-6.2 Sol ran the tests and drafted this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-24T19:38:25Z.
Two contributors checked independently and found that #313 #1371 solves the same problem (for #105) in a different way: #1607, group D20. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:43:44Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by TG0000 on 2026-11-25T15:27:38Z.
@DavidM1911 Rebased onto latest
main(heada07d1899f8738b406471ad6cd8af31240d3fa326) — thanks for testing!Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T15:49:40Z.
Independent RTX 3080 Ti recheck of a07d189. The unchanged workspace built and reported 1,274 passed, 0 failed and 46 ignored, including 26 runtime skips. Both stock packed-input checks passed with no skips.
I also checked the maintainer’s D20 combination. With only #309's synthetic test added, the first pixel was [0.25, -0.4, 0.75, 0.0]. Adding the isolated interleaved-mask fix made all 256 pixels match [0.25, 0.5, 0.75, 0.0]. The combined suite reported 1,275 passed, 0 failed and 46 ignored, including the same 26 skips.
Windows 11 build 26300, NVIDIA 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11. Synthetic tests only. AI-assisted. Codex (GPT-6, exact variant unavailable) integrated the test and fix locally, ran the checks and drafted this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:45:55Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:41:19Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:05:26Z.
Triage (#1607) – head
a07d189Overlap: #313 and #1371 fix the same packed-ISG1-input problem in other ways (#313: one float4 member per element, indexed by the element's mask; #1371: renamed duplicate members, still indexed by register channel, plus an unrelated fmt_encode change). #309 is stacked on this PR (it carries this commit) and adds mask-based selection for non-contiguous masks.
No problems found in the diff; main still declares one
a{register}member per element.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.