mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 19:48:37 +00:00
The translator handles the image atomics, image_get_resinfo, image_get_lod and the 32-bit image_bvh_intersect_ray, but no test ran them. Six hand-written fixtures now do, with the expected words derived in each header from the RDNA2 ISA definition of the instruction: - cs_imgatomic: add, sub, and, or, xor, smin, smax, umin, umax and cmpswap on a 2D r32 uint image. 0xfffffff0 tells the signed min/max from the unsigned ones, each with a case that goes the other way; cmpswap hits and misses; one op runs without glc; 63 lanes are off; 64 threads add to one texel. - cs_imgatomic3d: six cases on a 4x4x4 volume, the 3D path of the translator. - cs_resinfo: a 16x4 image with five levels: levels 0, 1 and 3 in full, then dmask 0x3, 0xa and 0x8. - ps_get_lod, ps_get_lod_array: calculated LOD 1 and 3 on the two-mip texture, the clamped LOD held by the last level and by the sampler's MAX_LOD; 2 and -3 on the one-level 2D array. - cs_bvh32: the scene of cs_bvh through the 11-dword address form. vk_store_test gets a "words" mode for the compute ones: it also binds the uint image and a small volume as r32ui storage images (bindings 4 and 7) and a 16x4 five-level image behind its real T#, fills the images and prints them; check.py holds the expected words. The other two run on vk_texture_test and vk_compute_test as they are. All pass on an RX 7900 XTX and a Ryzen 9 7950X3D integrated GPU (RADV, Mesa 26.3.1) and on llvmpipe, natively and with LEONIDA_W64_EMULATE=1, and are clean under the validation layer. No translator change was needed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
28 lines
1.3 KiB
NASM
28 lines
1.3 KiB
NASM
; image_get_lod on a 2D array (dim:SQ_RSRC_IMG_2D_ARRAY: s, t and the slice; ps_get_lod.asm has the plain 2D form and
|
|
; the rules). The slice takes no part in the LOD.
|
|
; Run: vk_texture_test vs_ids.spv ps_get_lod_array.spv out.raw 0 92 c00000 14500000 0
|
|
; The tool's 2D array (set 0 binding 3) is 8x8 with one level, drawn over 64x64 pixels with u and v from 0 to 1: a
|
|
; pixel step is 1/8 texel, so the calculated LOD is log2(1/8) = -3. The first query scales u by 32: four texels a
|
|
; pixel along x, log2(4) = 2. With a single level the clamped LOD is 0 for both.
|
|
; mrt0 = (clamped, calculated LOD at (32u, v); clamped, calculated LOD at (u, v)) = 0.0 2.0 0.0 -3.0
|
|
; on every pixel, within 1/16 (a device may keep as few as four fraction bits of LOD).
|
|
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_e32 v4, 2.0
|
|
s_load_dwordx8 s[8:15], s[0:1], 0
|
|
s_waitcnt lgkmcnt(0)
|
|
s_mov_b32 s16, 0x92
|
|
s_mov_b32 s17, 0xc00000
|
|
s_mov_b32 s18, 0x14500000
|
|
s_mov_b32 s19, 0
|
|
v_mul_f32_e32 v8, 0x42000000, v2
|
|
v_mov_b32_e32 v9, v3
|
|
v_mov_b32_e32 v10, v4
|
|
image_get_lod v[12:13], v[8:10], s[8:15], s[16:19] dmask:0x3 dim:SQ_RSRC_IMG_2D_ARRAY
|
|
image_get_lod v[14:15], v[2:4], s[8:15], s[16:19] dmask:0x3 dim:SQ_RSRC_IMG_2D_ARRAY
|
|
s_waitcnt vmcnt(0)
|
|
exp mrt0 v12, v13, v14, v15 done vm
|
|
s_endpgm
|