diff options
| author | Shuvam Pandey <shuvampandey1@gmail.com> | 2026-11-22 03:28:27 +0545 |
|---|---|---|
| committer | Shuvam Pandey <shuvampandey1@gmail.com> | 2026-11-22 03:47:22 +0545 |
| commit | 256da65a1b4fa7a2ecb9b45d9f8cb05fbe226fae (patch) | |
| tree | 0eb64d2f690492c04e1959197e46402522042260 /runtime/test | |
| parent | 36ace7135e897c228eede5d1d8c28e972285cb14 (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.asm | 40 | ||||
| -rw-r--r-- | runtime/test/shaders/cs_store.asm | 4 |
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 | ||
| 6 | v_cmpx_eq_u32_e32 0, v0 | ||
| 7 | v_mov_b32_e32 v1, 0xc00ffc00 | ||
| 8 | v_mov_b32_e32 v2, 0x3ff003 | ||
| 9 | v_mov_b32_e32 v3, 48 | ||
| 10 | buffer_store_dwordx2 v[1:2], v3, s[0:3], 0 offen | ||
| 11 | s_waitcnt_vscnt null, 0x0 | ||
| 12 | s_mov_b32 s4, s0 | ||
| 13 | s_mov_b32 s5, s1 | ||
| 14 | s_mov_b32 s6, s2 | ||
| 15 | s_mov_b32 s7, 0x32fac | ||
| 16 | buffer_load_format_xyzw v[4:7], v3, s[4:7], 0 offen | ||
| 17 | s_waitcnt vmcnt(0) | ||
| 18 | v_mov_b32_e32 v8, 0 | ||
| 19 | buffer_store_dwordx4 v[4:7], v8, s[0:3], 0 offen | ||
| 20 | s_mov_b32 s7, 0x2cfac | ||
| 21 | v_mov_b32_e32 v9, 52 | ||
| 22 | buffer_load_format_xyzw v[4:7], v9, s[4:7], 0 offen | ||
| 23 | s_waitcnt vmcnt(0) | ||
| 24 | v_mov_b32_e32 v8, 16 | ||
| 25 | buffer_store_dwordx4 v[4:7], v8, s[0:3], 0 offen | ||
| 26 | tbuffer_load_format_xyzw v[4:7], v3, s[4:7], 0 format:[BUF_FMT_2_10_10_10_UNORM] offen | ||
| 27 | s_waitcnt vmcnt(0) | ||
| 28 | v_mov_b32_e32 v8, 32 | ||
| 29 | buffer_store_dwordx4 v[4:7], v8, s[0:3], 0 offen | ||
| 30 | v_mov_b32_e32 v10, 1.0 | ||
| 31 | v_mov_b32_e32 v11, 0 | ||
| 32 | v_mov_b32_e32 v12, 0.5 | ||
| 33 | v_mov_b32_e32 v13, 1.0 | ||
| 34 | s_mov_b32 s7, 0x32fac | ||
| 35 | v_mov_b32_e32 v9, 56 | ||
| 36 | buffer_store_format_xyzw v[10:13], v9, s[4:7], 0 offen | ||
| 37 | s_mov_b32 s7, 0x2cfac | ||
| 38 | v_mov_b32_e32 v9, 60 | ||
| 39 | buffer_store_format_xyzw v[10:13], v9, s[4:7], 0 offen | ||
| 40 | s_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. |
| 4 | v_cmpx_eq_u32_e32 0, v0 | 4 | v_cmpx_eq_u32_e32 0, v0 |
| @@ -14,7 +14,7 @@ v_mov_b32_e32 v7, 0 | |||
| 14 | v_mov_b32_e32 v8, 0.5 | 14 | v_mov_b32_e32 v8, 0.5 |
| 15 | v_mov_b32_e32 v9, 1.0 | 15 | v_mov_b32_e32 v9, 1.0 |
| 16 | v_mov_b32_e32 v5, 4 | 16 | v_mov_b32_e32 v5, 4 |
| 17 | s_mov_b32 s3, 0x2c000 | 17 | s_mov_b32 s3, 0x32000 |
| 18 | buffer_store_format_xyzw v[6:9], v5, s[0:3], 0 offen | 18 | buffer_store_format_xyzw v[6:9], v5, s[0:3], 0 offen |
| 19 | s_mov_b32 s3, 0xd000 | 19 | s_mov_b32 s3, 0xd000 |
| 20 | v_mov_b32_e32 v10, 2.0 | 20 | v_mov_b32_e32 v10, 2.0 |