Recompiler: translate v_interp_mov_f32 P10 and P20 via GetAttributeAtVertex #1154
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1163"
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 GamingChelsea on 2026-11-24T12:44:04Z.
Translate
v_interp_mov_f32withP10(VSRC = 0,P1 - P0) andP20(VSRC = 1,P2 - P0) in pixel shaders using SM 6.1+GetAttributeAtVertex, instead of rejecting them as unsupported.What is in it
crates/xcl/src/gpu/recomp/emit.rsandcrates/xcl/src/gpu/recomp/mod.rs:v_interp_mov_f32P10/P20(ps_vertex_attrs) and forcenointerpolationfor them inps_attr_modessoGetAttributeAtVertexis valid.VSRC = 0(P10) toGetAttributeAtVertex(xi.aN, 1u) - GetAttributeAtVertex(xi.aN, 0u)andVSRC = 1(P20) toGetAttributeAtVertex(xi.aN, 2u) - GetAttributeAtVertex(xi.aN, 0u)on the raw attribute bits (VSRC = 2/P0is unchanged; invalidVSRC = 3remains unsupported).P10/P20reads an enabled(I, J)barycentric VGPR pair outsidev_interp_*(e.g. manualP0 + I * P10 + J * P20), populate(I, J)fromxi.xcl_bary.yzusing that pair's interpolation modifier (sample,"",centroid,noperspective sample,noperspective,noperspective centroid).P10/P20andv_interp_p2_f32/v_interp_p2_f16, interpolate from the three vertices usingSV_Barycentricswith that pair's modifier. ConflictingSV_Barycentricsmodifiers in one PS are refused (multiple SV_Barycentrics modes). Programs that do not useP10/P20emit identical HLSL.crates/xcl/src/gpu/recomp/tests.rs: addgpu_ps_interp_mov_p10_p20verifying pureP0/P10/P20, mixedP10/P20+v_interp_p1/p2, manualP0 + I * P10 + J * P20against hardwarev_interp_p1/p2across all 256 pixels,noperspective/centroidSV_Barycentricsmodifiers, conflicting-mode refusal, and rejection ofVSRC = 3.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2602.17, debug (tests) and release (smoke).cargo test --workspace -- --test-threads=1: 1266 passed, 0 failed, 46 ignored.SKIPPEDGPU tests on this adapter: 25 (22 wave64-onlyno wave64skips + 3#1426f16/f32 direct-DXIL per-lane skips).Regression run
main:
PR head:
Not tested
XCL_SAMPLE_RPF).AI use
v_interp_mov_f32P10/P20lowering,I/Jbarycentric VGPR initialization, and modifier-preservingSV_Barycentricsinterpolation, wrotegpu_ps_interp_mov_p10_p20, rebased onto06c9f55, ran the workspace test suite and smoke regression, and updated this PR description.Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-24T12:50:55Z.
Ran the new interpolation test on an NVIDIA Blackwell part at
2fb1f46:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
gpu_ps_interp_mov_p10_p20passes on the GPU here, and the existingps_interp_p0_preserves_bits_and_p2_converts_to_floatis unaffected. This adapter has no native wave64 and runs console wave64 VS/PS through the upper-lane form, so the changed path is exercised. The author's run was wave32 as well (RTX 4070); this adds a Blackwell part, Windows 11 build 26200 and DXC 1.9.2609.5.Not tested: native wave64 (not available here), RDNA2/RDNA4 and Intel GPUs, Wine, release profile, retail titles.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified.
Imported from ivall/xcl. Originally posted by bjarngard on 2026-11-24T13:05:05Z.
Test report for head
2fb1f46(AMD, native wave64)Tested
XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 742 passed, 0 failed, 41 ignored, no SKIPPEDXCL_REQUIRE_GPU=wave64:gpu_ps_interp_mov_p10_p20passedNot tested: retail titles, RDNA3/RDNA4.
AI use: the tests were run and this report was written by an AI agent, Claude Code (Claude Opus 5.5), on the hardware above. The numbers are copied from the actual test output.
Imported from ivall/xcl. Originally posted by CuteBooty on 2026-11-24T16:21:11Z.
2fb1f46makes a class of pixel shaderscomplete()that then draw the wrong value: the I / J barycentric VGPRs still start at0u, so a program that uses P10 / P20 for what they are for,P0 + I * P10 + J * P20, gives P0 for every pixel. On the base (47efa2e) such a program is refused (v_interp_mov p10/p20).Seen:
draw_psi()(I / J in v0 / v1),v5 = P0,v6 = P10,v7 = P20,v_mac_f32 v5, v0, v6,v_mac_f32 v5, v1, v7, export v5, with vertex values 1, 5, 9. The same attribute throughv_interp_p1/p2gives what it should be:v_interp_p1/p2The HLSL has
uint v0 = 0u;anduint v1 = 0u;. The P10 / P20 values themselves are fine, and a program that does not read I / J as numbers is not affected; the PR's test does not read them.Second, from the generated HLSL only (not drawn): the mixed path always declares plain
SV_Barycentrics. With only the linear (input_ena0x20) or only the centroid (0x4) pair enabled,p2on such an attribute becomes perspective-centre; on the base those attributes are declarednoperspective/centroid.Possible fixes: fill the enabled I / J VGPRs from
SV_Barycentricswith that pair's modifier, or keep refusing a program that uses P10 / P20 and reads I / J outsidev_interp_*.Tested: one scratch test on
2fb1f46and on47efa2e; RTX 3070 (32-lane waves), NVIDIA 621.24, Windows 11 Pro 26200, rustc 1.100.0 MSVC, debug.Not tested: other GPUs, wave64 hardware, the whole suite, a retail title, whether any retail shader does this.
AI use: Claude Code (Claude Opus 5.5) found this, ran the test and wrote the comment; Codex (GPT-6.2 Astra) checked it by reading the code, without running anything.
Imported from ivall/xcl. Originally posted by GamingChelsea on 2026-11-24T16:49:18Z.
Good catch on both counts @CuteBooty — fixed and squashed into
bbc5819(rebased on037aecd):P10/P20reads an enabled(I, J)barycentric VGPR pair outsidev_interp_*, those VGPRs are now populated fromxi.xcl_bary.yz(I = bary.y,J = bary.z) using that pair's interpolation modifier.(I, J)init path and the mixedP10/P20+v_interp_p2_*path now declareSV_Barycentricswith the pair's actual modifier (sample,centroid,noperspective, etc.), and conflictingSV_Barycentricsmodifiers in one PS are refused (multiple SV_Barycentrics modes).gpu_ps_interp_mov_p10_p20to check manualP0 + I * P10 + J * P20against hardwarev_interp_p1_f32/v_interp_p2_f32across all 256 pixels,noperspective/centroidSV_Barycentricsdeclarations (DXC-compiled), and conflicting-mode refusal.Full suite (
771 passed, 0 failed, 41 ignored) and updated 60 s smoke block pasted in the PR description.Imported from ivall/xcl. Originally posted by CuteBooty on 2026-11-24T16:59:59Z.
Thanks, both points are fixed in
bbc5819as far as my test shows: I reran it there, andP0 + I * P10 + J * P20gives the same asv_interp_p1/p2at the four sampled pixels (3.0625, 6.8125, 4.0625, 4.9375). The mixed path declaresnoperspective/centroidfor the linear and centroid pairs (from the generated HLSL).gpu_ps_interp_mov_p10_p20passes too.Tested: RTX 3070 (32-lane waves), NVIDIA 621.24, Windows 11 Pro 26200, rustc 1.100.0 MSVC, debug; these two tests only. Not tested: the whole suite, wave64 hardware, a retail title.
One nit: the doc comment of
ps_attr_modesnow sits onPS_BARY_PAIRS.AI use: Claude Code (Claude Opus 5.5) ran the tests, read the diff and wrote this.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:46:55Z.
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 GamingChelsea on 2026-11-25T14:18:41Z.
Rebased onto
06c9f55(d24d390) to resolve the merge conflict inemit.rs, moved the doc comment back ontops_attr_modes, and reran the full workspace suite (1266 passed, 0 failed, 46 ignored) + 60 s smoke regression (974frames vsmain831).Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:26:34Z.
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
upstream-sync referenced this pull request2026-11-26 05:05:05 +00:00
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:45:02Z.
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.Pull request closed