upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test
diff options
context:
space:
mode:
authorShuvam Pandey <shuvampandey1@gmail.com>2026-11-22 03:28:27 +0545
committerShuvam Pandey <shuvampandey1@gmail.com>2026-11-22 03:47:22 +0545
commit256da65a1b4fa7a2ecb9b45d9f8cb05fbe226fae (patch)
tree0eb64d2f690492c04e1959197e46402522042260 /runtime/test
parent36ace7135e897c228eede5d1d8c28e972285cb14 (diff)
Translator: 10:10:10:2 buffer formats had x and w swapped
GFX10 format names list the channel widths from the top bit, so 2_10_10_10 (50) is R10G10B10A2 and 10_10_10_2 (44) has a 2-bit x. FORMATS read them from bit 0, which swapped the two for typed buffer loads and stores. cs_store now writes its R10G10B10A2 word through 50. cs_fmt_1010102 covers both formats; to run it, buffer_load_format masks a shift that was 32 for aligned elements, and the test interpreter gains the conversions it needs.
Diffstat (limited to 'runtime/test')
-rw-r--r--runtime/test/shaders/cs_fmt_1010102.asm40
-rw-r--r--runtime/test/shaders/cs_store.asm4
2 files changed, 42 insertions, 2 deletions
diff --git a/runtime/test/shaders/cs_fmt_1010102.asm b/runtime/test/shaders/cs_fmt_1010102.asm
new file mode 100644
index 000000000..c92ec4e2a
--- /dev/null
+++ b/runtime/test/shaders/cs_fmt_1010102.asm
@@ -0,0 +1,40 @@
1; 10:10:10:2 typed buffers. Format names list the channel widths from the top bit: 2_10_10_10 (50) is R10G10B10A2
2; with x in bits 9:0, and 10_10_10_2 (44) has a 2-bit x in bits 1:0. out[12..13] = 0xc00ffc00 0x003ff003 (raw),
3; out[0..3] = out[12] read as 50, out[4..7] = out[13] read as 44, out[8..11] = out[12] read by tbuffer as 50 through
4; a V# that says 44, out[14..15] = (1, 0, 0.5, 1) stored as 50 and 44 = 0xe00003ff 0xffe00003.
5; Run: vk_compute_test cs_fmt_1010102.spv 1 dump -> out[0..7] = 0 0x3f800000 0 0x3f800000 0x3f800000 0 0x3f800000 0
6v_cmpx_eq_u32_e32 0, v0
7v_mov_b32_e32 v1, 0xc00ffc00
8v_mov_b32_e32 v2, 0x3ff003
9v_mov_b32_e32 v3, 48
10buffer_store_dwordx2 v[1:2], v3, s[0:3], 0 offen
11s_waitcnt_vscnt null, 0x0
12s_mov_b32 s4, s0
13s_mov_b32 s5, s1
14s_mov_b32 s6, s2
15s_mov_b32 s7, 0x32fac
16buffer_load_format_xyzw v[4:7], v3, s[4:7], 0 offen
17s_waitcnt vmcnt(0)
18v_mov_b32_e32 v8, 0
19buffer_store_dwordx4 v[4:7], v8, s[0:3], 0 offen
20s_mov_b32 s7, 0x2cfac
21v_mov_b32_e32 v9, 52
22buffer_load_format_xyzw v[4:7], v9, s[4:7], 0 offen
23s_waitcnt vmcnt(0)
24v_mov_b32_e32 v8, 16
25buffer_store_dwordx4 v[4:7], v8, s[0:3], 0 offen
26tbuffer_load_format_xyzw v[4:7], v3, s[4:7], 0 format:[BUF_FMT_2_10_10_10_UNORM] offen
27s_waitcnt vmcnt(0)
28v_mov_b32_e32 v8, 32
29buffer_store_dwordx4 v[4:7], v8, s[0:3], 0 offen
30v_mov_b32_e32 v10, 1.0
31v_mov_b32_e32 v11, 0
32v_mov_b32_e32 v12, 0.5
33v_mov_b32_e32 v13, 1.0
34s_mov_b32 s7, 0x32fac
35v_mov_b32_e32 v9, 56
36buffer_store_format_xyzw v[10:13], v9, s[4:7], 0 offen
37s_mov_b32 s7, 0x2cfac
38v_mov_b32_e32 v9, 60
39buffer_store_format_xyzw v[10:13], v9, s[4:7], 0 offen
40s_endpgm
diff --git a/runtime/test/shaders/cs_store.asm b/runtime/test/shaders/cs_store.asm
index 846f0da49..d8598a00a 100644
--- a/runtime/test/shaders/cs_store.asm
+++ b/runtime/test/shaders/cs_store.asm
@@ -1,4 +1,4 @@
1; buffer_store_format encoder: rgba8 unorm (56), 10:10:10:2 unorm (44), two r16f (13) halves of one dword (atomic merge), 1; buffer_store_format encoder: rgba8 unorm (56), 2_10_10_10 unorm (50), two r16f (13) halves of one dword (atomic merge),
2; d16 rgba16f (71). Run: vk_compute_test cs_store.spv 1 dump -> out[0..5] = 0x400080ff 0xe00003ff 0x3c004000 2; d16 rgba16f (71). Run: vk_compute_test cs_store.spv 1 dump -> out[0..5] = 0x400080ff 0xe00003ff 0x3c004000
3; 0xeeeeeeee (untouched) 0x40003c00 0xbc003800. Same FSSM header as cs_lds. 3; 0xeeeeeeee (untouched) 0x40003c00 0xbc003800. Same FSSM header as cs_lds.
4v_cmpx_eq_u32_e32 0, v0 4v_cmpx_eq_u32_e32 0, v0
@@ -14,7 +14,7 @@ v_mov_b32_e32 v7, 0
14v_mov_b32_e32 v8, 0.5 14v_mov_b32_e32 v8, 0.5
15v_mov_b32_e32 v9, 1.0 15v_mov_b32_e32 v9, 1.0
16v_mov_b32_e32 v5, 4 16v_mov_b32_e32 v5, 4
17s_mov_b32 s3, 0x2c000 17s_mov_b32 s3, 0x32000
18buffer_store_format_xyzw v[6:9], v5, s[0:3], 0 offen 18buffer_store_format_xyzw v[6:9], v5, s[0:3], 0 offen
19s_mov_b32 s3, 0xd000 19s_mov_b32 s3, 0xd000
20v_mov_b32_e32 v10, 2.0 20v_mov_b32_e32 v10, 2.0