Shaders: P0 beside an interpolation of the same row (NEW-120, stacked on #3335) #3553
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!3553
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3553"
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?
@artor410 on GitHub · 2026-11-27 17:19 UTC · original
artor410:new-120-p0-beside-interp→main· +1223 −476 · 7 files · 5 commits · openNEW-120 (#1633). Stacked on #3335: only the last commit (
1101cd9) is new here.A pixel program that reads P0 (
v_interp_mov_f32 p0) of an attribute row and also interpolates that row is refused withone input interpolated two ways, onmainand on #3335: P0 wants a constant element, the interpolation a perspective one. #3335'sper_vertexalready handles P10/P20 of an interpolated row this way but skips P0.Fix:
per_vertexalso counts P0 of a row the program interpolates. The element becomes constant, P0 is its provoking vertex (flat load), and the interpolation weighs the vertices withSV_Barycentrics, the same path P10/P20 use. P0 alone keeps the plain flat read and declares no barycentrics.This is the case #1738 fixed before it was closed; #3335 doesn't carry it.
Tests (synthetic only, no title data)
p0_beside_an_interpolation_of_the_row: P0 before or after the p1/p2 pair, on the same channel or another. Each case translates, sets the Barycentrics feature, declares oneSV_Barycentrics, makes TEXCOORD0 constant, and passes the DXIL validator. It fails on #3335 without this commit.p0_alone_declares_no_barycentrics: no regression for P0 on its own.cargo test -p victory-shader --libon RTX 3070 Ti (Windows 11): 310 passed, 3 failed. The 3 failures are the onesmainalready has on this card (stride_tests×2,gathers_at_a_level_match_the_hardware). I skippedheap_direct_texture_reads_mark_their_heap_indexbecause it crashes the process on NVIDIA (FIND-36).cargo clippy -p victory-shader --all-targets -D warningsis clean.Not run: a render readback of the new case.
🤖 Generated with Claude Code
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 <[email protected]> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66@kilolimaVI on GitHub · 2026-11-27 17:45 UTC · original · reviewed
Windows run with the DXIL validator present (Windows SDK
dxil.dll), head1101cd9, Radeon 780M (RDNA3 iGPU), toolchain 1.98.1:barycentric_tests: 11 passed, 0 failed, so every new SV_Barycentrics shape (includingp0_beside_an_interpolation_of_the_row) validates; Linux CI skips that step.cargo test -p victory-shaderon the 780M: 314 passed, 0 failed.These tests validate but don't draw, so vertex order under
GetAttributeAtVertexon real hardware isn't covered by them; I can add an AMD draw test for P0/P10/P20 against an interpolated row if that's useful.AI-assisted (Claude).
@kilolimaVI on GitHub · 2026-11-27 18:57 UTC · original
Follow-up with a draw test, as offered above: https://github.com/kilolimaVI/VIctory/commits/tests/barycentric-draw (one commit on top of
1101cd9, a new fileemit/barycentric_draw_tests.rs).It draws a triangle in general position whose three vertices carry distinct TEXCOORD0 values, through six pixel programs, and compares every covered pixel with the weights at its centre: x and y interpolated; I and J read as values; x with a computed I; x interpolated beside P0 of y (NEW-120); P10 beside it; P0 alone. So
SV_BarycentricsandattributeAtVertexmust keep the console's vertex order (P0 the provoking vertex, I and J the weights of vertices 1 and 2).Radeon 780M (RDNA3) and WARP: 95 pixels per case, 0 wrong in all twelve, with the DXIL validator on. Feel free to cherry-pick it into this PR.
AI-assisted (Claude).
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 19:08 UTC · original
I ran @kilolimaVI's synthetic draw test on Windows WARP 1.0.22 with Agility SDK 1.620.2 and DXIL validation required. All six draws read back 95 covered pixels each with zero mismatches. That includes ordinary interpolation, the I/J values, computed I, P0 on a row also being interpolated, P10 on that row, and P0 alone. The 11 existing barycentric lowering tests passed too.
With
VICTORY_WARP=1, the offered fixture printed the same WARP device under both adapter labels. Test branch preserves @kilolimaVI's exact7eff061on this PR's1101cd9, then adds0f3d463to run WARP once and to check the adapter'sSV_Barycentricssupport before drawing. The six readbacks above were repeated on that tip. Strict shader Clippy passed for default and all features, and the asset policy check passed.@artor410 can bring both test commits into #3553 if useful. Please retain the respective Git authors on cherry-pick or rebase. If you fold my follow-up into another commit, please include
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.