Recompiler: PS sample index and fixed-point position VGPRs get values #1341
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1351"
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 emirduran707 on 2026-11-24T15:08:36Z.
A pixel shader's system VGPRs were given values only for the inputs XCL already knew (persp/linear barycentrics, position, front face). Every other one enabled in
SPI_PS_INPUT_ENAstarted as 0, including:SV_SampleIndex(per-sample shading, an MSAA resolve) got 0 on every sample, and the PC PS was not run per sample.Mesa's
ac_nir_lower_intrinsics_to_args.creads them so:load_sample_idisac_nir_unpack_arg(…, ancillary, 8, 4), and the pixel coordinate ispos_fixed_ptsplit into two 16-bit halves.When ANCILLARY is enabled and the input signature has
SV_SampleIndex(system value 10),XclIndeclares it and the ancillary VGPR starts at(si & 0xF) << 8. POS_FIXED_PT starts fromSV_Position's integer coordinates. A PS without these gets the same HLSL as before; withoutSV_SampleIndexin its signature it is not made per-sample.What is in it
crates/xcl/src/gpu/recomp/emit.rs: the two start values and theSV_SampleIndexinput.crates/xcl/src/gpu/recomp/tests.rs:ps_ancillary_and_pos_fixed_vgprs, which compiles through DXCps_6_6when present. It coversSV_SampleIndex, bit 13 without it, bit 15, and a PS without either (same text as before).Tested
cargo test --workspace -- --test-threads=4on00e3c4a: 752 passed, 0 failed, 41 ignored; no SKIPPED GPU testsemit.rsfails (uint v2 = 0u;, noSV_SampleIndex); with it it passesRegression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T15:15:13Z.
Full-suite run, since this PR has no test report yet. Tested exact head
00e3c4a(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.ps_ancillary_and_pos_fixed_vgprs.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by Mischief8713 on 2026-11-24T15:55:09Z.
GPU run of
00e3c4aon Windows (NVIDIA GTX 1660 Ti, Turing): 708 passed, 0 failed; the new test passesTested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64)mainat930e8b4on the same machine: lib 707 passed, 0 failed, 21 ignored;e2e3 passedmain.gpu::recomp::tests::ps_ancillary_and_pos_fixed_vgprsran and passed.Not tested
scripts/smoke.ps1run, so no regression runAI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:17:59Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (One run showed a single flaky failure / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by kacper-serewis on 2026-11-24T20:23:40Z.
GPU readback for this PR (its own test checks the HLSL): pass on
00e3c4a, fails on the base.Tested: RTX 5070, driver 32.0.16.1656, Windows 11, debug.
930e8b400e3c4aPOS_FIXED_PT, 16x16: wrong pixelsFixtures: one full-target triangle into R32G32B32A32_FLOAT.
SPI_PS_INPUT_ENA0x8002. The PS takes x from v2[15:0] and y from v2[31:16] and exports (x, y, 0, 1); expected: the pixel's integer coordinates.SPI_PS_INPUT_ENA0xA002,SV_SampleIndexin the input signature. The PS exports (v2[11:8], v3[15:0], v3[31:16], 1), and a compute shader reads every sample withTexture2DMS.Load; expected: (sample, x, y, 1).The full tests are available on request.
Not tested: direct DXIL, native wave64 (this GPU has 32-lane waves only), AMD.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment. I checked the points before posting.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:00:03Z.
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 throny on 2026-11-28T23:26:21Z.
merge-check claim
head:
00e3c4a56aImported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-29T00:06:47Z.
merge-check
base:
cad0164a90head:
00e3c4a56amerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2601 passed, 0 failed, 49 ignored; SKIPPED: 28 (mostly "no wave64", plus "no heap windows", "no GPU_UPLOAD heaps", "no build ahead"); failing: none
review: one gap after reading the whole diff, not a blocker. The change is in the HLSL emitter only (
emit.rs). Since #3243 (in this base) pixel shaders take direct DXIL by default, and its PS setup (dxil/lower_gfx.rs, initial VGPRs) fills only POS (bits 8-11), front face (12) and coverage (14). It does not fill the ancillary VGPR (13) or POS_FIXED_PT (15), and it does not refuse a PS that enables them, so the values this PR adds reach only PS that fall back to HLSL, or runs withXCL_DIRECT_DXIL=0/1. (From reading; not run through a title.) The HLSL part is right as far as I can read: SV_SampleIndex is declared only when the console signature has it, so a PS does not newly run per sample.ps_ancillary_and_pos_fixed_vgprspasses 3/3 here, and with the POS_FIXED_PT branch disabled (scratch) it fails. The DXC compile of the test's HLSL ran.performance: default path unchanged except for PS that fall back to HLSL and enable the ancillary VGPR with SV_SampleIndex in their signature: those run per sample, as the console signature asks. Reasoned, not measured.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug / Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:11:37Z.
merge-check
base:
851bf7f9head:
00e3c4a56amerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2597 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
851bf7f9: 2596 passed, 0 failed, 49 ignored.review: no blocking finding; all hunks read. The bit layout of the two inputs matches the public driver sources the PR cites (sample index in the ancillary word, the fixed-point position with x low and y high). The sample index is declared only when the console's signature has it, so a pixel shader runs per sample only where the console's did. Follow-up, not blocking: the direct-DXIL pixel path still starts these two registers at zero.
performance: per-sample shading only where the console shaded per sample. It changes a translator source: every tester re-translates all shaders once.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).