Files
mandy/runtime/test/shaders/ps_persp_bary.asm
DANISBR1 1291a6878c GPU tests: raw barycentrics under perspective (ps_persp_bary, vs_persp)
The raw-barycentric tests draw with vs_ids, where clip w = 1 at every vertex, so nothing checked that the raw
i/j (and the attributes) follow perspective-correct weights. vs_persp draws one triangle at screen (5,8),
(57,16), (21,55) with clip w = 1, 2, 4 and per-vertex attr0; ps_persp_bary is ps_bary's code drawn with it.
check.py's bary_persp_problem compares every pixel with CPU weights p_k = (l_k / w_k) / sum(l_m / w_m) from the
screen-space weights l_k, checks that pixels outside stay clear, and requires the affine weights to differ by
more than 100x the tolerance on every judged pixel, so a NoPerspective regression can't pass. run_gpu_tests.py
uses the same reference (PIXEL_VS, DRAWN_WITH). Suggested by Vonsek in #794.

On main it runs the native BaryCoordKHR path (it skips without VK_KHR_fragment_shader_barycentric, like
ps_bary); any barycentric fallback that lands (#804) is exercised by it too. Checked on an RX 5700 XT (RADV)
through a GS fallback: passes at wave32 and wave64; with NoPerspective on the fallback's input, all 1149
covered pixels fail while the interpolated attributes still match. New tests/test_bary_persp_oracle.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:37:21 -06:00

13 lines
675 B
NASM

; ps_bary's code, drawn with vs_persp (clip w = 1, 2, 4) instead of vs_ids (w = 1): attr0.xy and the raw i/j
; (v0, v1) must follow the perspective-correct weights. At a pixel centre with screen-space weights l0, l1, l2 of the
; three vertices, p_k = (l_k / w_k) / sum(l_m / w_m); mrt0 = (sum p_k attr0_k.x, sum p_k attr0_k.y, p1, p2). The
; affine weights (l1, l2) differ by at least 0.007 on every covered pixel, so NoPerspective interpolation fails it.
v_interp_p1_f32_e32 v2, v0, attr0.x
v_interp_p2_f32_e32 v2, v1, attr0.x
v_interp_p1_f32_e32 v3, v0, attr0.y
v_interp_p2_f32_e32 v3, v1, attr0.y
v_mov_b32 v4, v0
v_mov_b32 v5, v1
exp mrt0 v2, v3, v4, v5 done vm
s_endpgm