Shaders: interpolate by hand rows read flat and interpolated; zero and copied barycentrics #1451
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1451
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1451/head"
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?
@federalcontraband on GitHub · 2026-11-24 18:06 UTC · original
federalcontraband:shaders-manual-interpolation→main· +412 −36 · 5 files · 1 commits · closed without mergingvictory 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
@Marvisak on GitHub · 2026-11-25 00:40 UTC · original
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