Files
mandy/runtime/test/shaders/ms_tri.asm
NotRexed 95447e081e Translator: mesh and geometry shaders, SCC from scalar ALU, general buffer format stores, more CS ops
- Mesh shaders -> VK_EXT_mesh_shader: PSV0 limits/topology/group size, v5 = workgroup index, s3 = wave
  id << 24, NGG exports staged per thread and written after OpSetMeshOutputsEXT (GS_ALLOC_REQ counts).
  GPU-checked (VKH_MESH mode in vk_harness).
- Geometry shaders ($GS_VoxelizeGeneric): LDS-ring inputs/outputs mapped to gl_in / staged slots,
  EMIT/CUT -> OpEmitVertex/OpEndPrimitive. GPU-checked (VKH_GS mode).
- SCC is now set by s_and/or/xor/andn2/orn2/nand/nor/xnor/lshl/lshr_b32 (result != 0),
  s_add/sub_i32 and s_addk_i32 (signed overflow), s_min/max_u32; it was left stale before. GPU-checked.
- buffer_store_format(_d16) encodes every table format (sub-dword elements via atomics); it silently
  stored nothing for most formats before. GPU-checked with vk_compute_test.
- Far branches folded; d16 buffer loads; gather4_l(_o) emulation; gather offsets; 1D/a16 image stores;
  BITMASK_PERM swizzles; f64 add/convert; i24 mul/mad, alignbyte, xnor, ffbh_i32, swap, s_abs, s_bfm,
  64-bit ordered/cmpx compares, 16-bit compares, 8/16-bit global loads, neg() operands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 21:48:58 -05:00

27 lines
1022 B
NASM

; Mesh shader (NGG, wave64, 128 threads): thread id = s3[27:24]*64 + mbcnt; GS_ALLOC_REQ m0 = 1 prim << 12 | 3 verts;
; threads 0-2 export the vk_harness triangle and attr0, thread 0 exports prim (0,1,2). Needs a DXBC with PSV0
; (128 threads, 64/64 outputs, triangles). Run: VKH_MESH=1 vk_harness ms_tri.spv fs_passthru.spv out.raw ->
; every pixel = ((x+0.5)/64, (y+0.5)/64, 0.5, 1).
v_mbcnt_lo_u32_b32 v0, -1, 0
v_mbcnt_hi_u32_b32 v0, -1, v0
s_bfe_u32 s4, s3, 0x40018
v_lshl_add_u32 v0, s4, 6, v0
v_cmp_eq_u32_e32 vcc_lo, 1, v0
v_cndmask_b32_e64 v1, -1.0, 0x40400000, vcc_lo
v_cndmask_b32_e64 v3, 0, 2.0, vcc_lo
v_cmp_eq_u32_e32 vcc_lo, 2, v0
v_cndmask_b32_e64 v2, -1.0, 0x40400000, vcc_lo
v_cndmask_b32_e64 v4, 0, 2.0, vcc_lo
v_mov_b32_e32 v6, 0
v_mov_b32_e32 v7, 1.0
v_mov_b32_e32 v8, 0.5
s_mov_b32 m0, 0x1003
s_sendmsg sendmsg(MSG_GS_ALLOC_REQ)
v_cmpx_gt_u32_e32 3, v0
exp pos0 v1, v2, v6, v7 done
exp param0 v3, v4, v8, v7
v_cmpx_eq_u32_e32 0, v0
v_mov_b32_e32 v9, 0x200400
exp prim v9, off, off, off done
s_endpgm