Shaders: interpolate by hand rows read flat and interpolated; zero and copied barycentrics #1450
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1451"
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 Marvisak/VIctory. Originally posted by federalcontraband on 2026-11-24T18:06:07Z.
victory translate --validateover the title's shaders, before and after (mainatffe310e):Per program, 126 go from failing to validated and none from validated to failing. Two that failed the row check now fail later, on "Program Input Signature does not match".
What the 207 "computed barycentrics" were
None of them compute their barycentrics. With a temporary trace of where
jcomes from:i = j = 0:v_mov_b32 vN, 0into both, thenv_interp_p1/p2. That is P0 + 0·P10 + 0·P20, the provoking vertex's value, which is the same asv_interp_mov_f32 ... p0. MostlyPS_ShadowRender_CSM_*and similar.i/jthrough a phi that merges the loaded value with a value from another path, where v0/v1 were reused as scratch. Not handled here.Changes
io.rsv_mov_b32copies, with the same conditions asresource::vorigin: no abs/neg/SDWA/DPP.iandjare both the constant 0 becomesInterp::Vertex { vertex: 2 }.emitmanual_rowslists the pixel input rows whose reads need more than one mode, counting integer and system-value elements (the front face) as constant.nointerpolation.loadInput.Σ AttributeAtVertex(k) · SV_Barycentrics[k], with anSV_Barycentricsinput per mode (at most one perspective and one linear, as D3D12 allows).SV_BarycentricsandAttributeAtVertexcome with the Barycentrics shader flag (bit 22) and SFI0 feature0x20000.emit::emit, an element packed into a row with a constant element now defaults to constant too. That fixes most of the 48 pre-existing "differs from another element packed into the same row" errors: unread float elements defaulted to linear beside the integer element or front face in their row.Tests
io::tests::interpolation_from_copied_barycentricsio::tests::interpolation_at_zero_barycentrics_is_the_provoking_vertex(one zero weight alone is still refused)emit::tests::a_row_read_flat_and_interpolated_is_interpolated_by_hand: emits, passesdxil.dll, declaresSV_Barycentricsand the SFI0 bit.All tests use hand-encoded instructions; no title data.
cargo test --workspacepasses (345) and clippy is clean.Not verified
SV_BarycentricsneedsD3D12_OPTIONS3.BarycentricsSupported(RDNA2+, Turing+, Xe). This change doesn't query it. On a GPU without it, these pipelines fail to create, which is where these programs already were.AttributeAtVertexandSV_Barycentricssharing an order, which D3D12 defines. P0 reads still go throughnointerpolationloadInput, so they don't depend on which vertexAttributeAtVertex(0)is.Tested on: Windows 11, RX 9060 XT (RDNA4), driver 32.0.31044.16.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T19:25:04Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e),cargo test -p victory-shader --locked→ 99. GPU/valu execution tests are Windows-gated and were not run here.Rows read both flat and interpolated are now interpolated by hand:
manual_rowscomputes the per-row mode bitmask from the stage inputs (fp16 pack2 rows included, integer/system values forced flat),barycentricsderives the sample position, andinterpolateemits the row reads. Signature/container carry the new metadata. Three macOS tests inemit/mod.rscover the flat+interpolated case (99 passed, +3). The remaining execution coverage is Windows-gated.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:40:32Z.
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1682. By-hand interpolation for the 207 'computed barycentrics' programs: main solved that class another way (io.rs
joined/unless, containersame_mode_per_row; 207 -> 0), and the same author's #1682 is a superset.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed