Recompiler: VS inputs packed into one ISG1 register are members of their own (#105) #297
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!297
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@TG0000 on GitHub · 2026-11-23 22:39 UTC · original
TG0000:fix/vs-packed-isg1-inputs→main· +139 −4 · 2 files · 1 commits · openPart 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
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 <[email protected]>github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@mastrr9 on GitHub · 2026-11-23 22:52 UTC · original
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)
@likecrank-dotcom on GitHub · 2026-11-23 23:05 UTC · original
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.
@thehollowedone on GitHub · 2026-11-24 00:26 UTC · original · edited 2026-11-24 00:32 UTC
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.
@throny on GitHub · 2026-11-24 19:38 UTC · original
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.
@DavidM1911 on GitHub · 2026-11-25 14:43 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@TG0000 on GitHub · 2026-11-25 15:27 UTC · original
@DavidM1911 Rebased onto latest
main(heada07d1899f8738b406471ad6cd8af31240d3fa326) — thanks for testing!@thehollowedone on GitHub · 2026-11-25 15:49 UTC · original
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.
@DavidM1911 on GitHub · 2026-11-26 02:45 UTC · original
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
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.