Files
mandy/runtime/test/shaders/ps_quad_flat.asm
QemmHD 6ce66cf219 d3d12: GPU test for indexed quad lists: both index sizes, a base vertex, flat inputs, overlapping instances (d3d12_quad_index)
d3d12_rect_list draws its quads without an index buffer, so it could not see what #207's
review measured on indexed ones. d3d12_quad_index_test draws six 64x64 frames through
DrawIndexedInstanced with IASetPrimitiveTopology(19) and compares every pixel bit for bit:

  0  non-indexed control
  1  16-bit indices, a quad whose corners all differ: the first vertex's colour everywhere
  2  32-bit indices from StartIndexLocation 3
  3  16-bit indices from StartIndexLocation 5 (an address of 2 modulo 4), BaseVertexLocation 3
  4  two quads and two instances whose quads overlap: the later instance on top
  5  a view that ends inside the second quad: its last two indices read 0

The index buffer is in a DEFAULT heap and filled by a copy in the first list, so only the
GPU can read it. Two translated fixtures, like vs_m15 and ps_m15: vs_quad_inst.asm reads
the instance id (v3) to move and recolour each later instance, ps_quad_flat.asm reads its
colour with v_interp_mov, which makes the input Flat.

RTX 4070 SUPER (621.24), Windows 11, LEONIDA_VK_VALIDATION=1:
  on the six commits of #207: frames 1, 2, 3 and 5 match in 0 of 4096 pixels (black and
  blue, the second and third vertex), frame 4 in 2048, frame 0 in 4096; exit 1
  with the expansion: 4096 of 4096 in all six, 0 validation errors

run_gpu_tests.py lists the two fixtures as run by this test, and docs/testing.md names the
test (and d3d12_rect_list) among those that need llvm-mc and the SPIR-V tools.

AI-assisted (Claude Code; Claude Opus 5.5 and Claude Fable 5.2).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-24 05:10:19 -05:00

16 lines
784 B
NASM

; Pixel shader for the indexed quad-list test: param0 (a colour) read only with v_interp_mov, so the input is Flat
; and every pixel of a primitive gets the provoking vertex's colour, unscaled. Run: d3d12_quad_index_test, with
; vs_quad_inst.
; mrt0 = param0 of the primitive's provoking vertex
; A quad list takes it from the quad's first vertex. The test's quads have a different colour at each corner, so
; a quad drawn from any other vertex shows that vertex's colour instead; the colours are 0 and 1, exact in the float
; render target.
; fssm-at: 0x10
; fssm-data: 0x44415551 0x20535020
v_interp_mov_f32_e32 v2, p0, attr0.x
v_interp_mov_f32_e32 v3, p0, attr0.y
v_interp_mov_f32_e32 v4, p0, attr0.z
v_interp_mov_f32_e32 v5, p0, attr0.w
exp mrt0 v2, v3, v4, v5 done vm
s_endpgm