Repository navigation
Conversation
Pixel programs that use the I/J VGPRs as plain values (custom interpolation, math on the weights) failed with "barycentrics read directly". They are now channels y and z of an SV_Barycentrics input (SM 6.1+, the emitter targets 6.6) declared with the interpolation mode of their kind (perspective/linear, center/centroid/sample), one element per mode (semantic index 0 and 1), with the Barycentrics shader flag and SFI0 feature. GFX10 interpolates P0 + i (P1 - P0) + j (P2 - P0) with P0 the provoking vertex, which the host's barycentrics weight as vertex 0, so i = y and j = z. The VGPRs are loaded on first use as a value, so programs that only feed them to v_interp_* declare nothing new. A console signature's own SV_Barycentrics row (D3D name 23) is parsed and reused. Pull-model barycentrics stay unsupported. SV_Barycentrics is left unpacked (no row, packing location -1), like other non-packed system values: the DXIL validator refuses it in a row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
v_interp_p1/p2 (and the f16 forms) fed with an i or j that is not the loaded input VGPR now evaluate each half as the hardware does: P0 + i (P1 - P0) for the first, the old dst + j (P2 - P0) for the second, with the vertex values read by attributeAtVertex. That needs the element declared constant, so every other interpolation of the same attribute row is weighed from its vertices with SV_Barycentrics of its mode, and flat reads stay loadInput of the provoking vertex. v_interp_mov of P10 and P20 reads P1 - P0 and P2 - P0 the same way when the program also interpolates the attribute (so the hardware holds the deltas); alone it is still refused. The translate command's tally counts Interp::Weighted as interpolated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
lower.rs: keep the PR's lazy barycentric VGPR inputs next to main's `Reg::S(n)` arm for uninitialized SGPRs. mod.rs: the barycentric test helper passes the structure to resource::track, which now takes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
DXIL allows at most two SV_Barycentrics input elements, one perspective
and one linear. A program reading both perspective center and centroid
I/J as values declared two perspective elements, which the validator
refuses ("There can only be up to two input attributes of
SV_Barycentrics with different perspective interpolation mode").
The second mode of the same kind is now an Unsupported reason rather
than a second element. Reusing the first element would hand centroid
reads center weights (or the reverse), which differ on edge pixels: a
silent wrong value. Before this PR such reads were refused anyway.
Test: center + centroid values are refused; centroid alone still
translates with one element.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
…polation values and pixel barycentrics
…wer.rs under the size limit) The merged Marvisak#453 and Marvisak#1738 changes took emit/lower.rs to 533,630 bytes, over the asset policy's 524,288-byte limit. Their methods (lazy_barycentric, barycentric, interp, per_vertex, interpolated, eval_channel, vertex_input) and the two mode helpers move unchanged to emit/lower/interp.rs, as the permlane code did in Marvisak#3587. lower.rs is 518,013 bytes now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified on AMD Radeon 780M (RDNA3, Ryzen 7 8845HS), Windows 11, head 6f32448.
This matches #3553's result on the same test, so the two PRs render identically here; the choice between them can be made on the code alone. AI-assisted (Claude). |
|
This covers hosts that have SV_Barycentrics. Hosts that do not have it end up on There is a second route that needs no system value at all, and it works together with this PR
Measured on that card: refusals of the barycentric kind 249 -> 0, pipelines built during loading The code, GPL-3.0-or-later, two commits on branch barycentric-emu: Four sites: lower.rs fn barycentric, lower.rs fn vertex_input, rect.rs/mod.rs (barycentric_gs, |
This reopens #1738 by @jaschinski97-ops (live interpolation values), which includes the pixel-barycentrics work of #453 by @AntoninMichelq that it builds on. Both were closed on 2026-11-26 without being merged. The change is still needed on
main: one pixel program the title runs in the intro is refused withemit: barycentrics read directly.The branch is #1738's last head (
9d59892) merged ontomain63bcca4. The merge is clean, and all original commits and authors are kept.Measured on an RX 7900 XTX (driver 32.0.32029.2010), Windows 11:
shaders.rpf(translate --validate --list, 26,084 programs), compared withmain63bcca4program by program: +1, 0 lost. The one is that "barycentrics read directly" refusal.cargo test -p victory-shader --lib --locked: 325 passed, 0 failed.maincan take merges more often #3347, the intro runs with 0 dropped draws and faces drawn.Merge notes for the open shader PRs touching the same code (#1924, #2978, #385, #2999) are in my comment on #1738.
I'm happy to hand this back if any of the original authors wants to continue it. AI-assisted (Claude Code); counts only, no game data.