Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 1 | #version 310 es |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 2 | |
Ben Clayton | 9dc42ad | 2024-02-05 18:01:33 +0000 | [diff] [blame] | 3 | shared ivec4 src_workgroup[4]; |
| 4 | void tint_zero_workgroup_memory(uint local_idx) { |
| 5 | { |
| 6 | for(uint idx = local_idx; (idx < 4u); idx = (idx + 1u)) { |
| 7 | uint i = idx; |
| 8 | src_workgroup[i] = ivec4(0); |
| 9 | } |
| 10 | } |
| 11 | barrier(); |
| 12 | } |
| 13 | |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 14 | struct S { |
| 15 | ivec4 arr[4]; |
| 16 | }; |
| 17 | |
| 18 | ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); |
Stephen White | 05d8b02 | 2022-09-13 19:48:51 +0000 | [diff] [blame] | 19 | layout(binding = 0, std140) uniform src_uniform_block_ubo { |
Stephen White | 863d9ed | 2022-09-02 19:19:10 +0000 | [diff] [blame] | 20 | S inner; |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 21 | } src_uniform; |
Stephen White | e2f35ba | 2022-01-26 16:48:55 +0000 | [diff] [blame] | 22 | |
Stephen White | 863d9ed | 2022-09-02 19:19:10 +0000 | [diff] [blame] | 23 | layout(binding = 1, std430) buffer src_uniform_block_ssbo { |
| 24 | S inner; |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 25 | } src_storage; |
Stephen White | 863d9ed | 2022-09-02 19:19:10 +0000 | [diff] [blame] | 26 | |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 27 | ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); |
| 28 | int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 29 | ivec4[4] ret_arr() { |
dan sinclair | a01fd24 | 2023-12-05 20:23:42 +0000 | [diff] [blame] | 30 | ivec4 tint_symbol_2[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); |
| 31 | return tint_symbol_2; |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | S ret_struct_arr() { |
dan sinclair | a01fd24 | 2023-12-05 20:23:42 +0000 | [diff] [blame] | 35 | S tint_symbol_3 = S(ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0))); |
| 36 | return tint_symbol_3; |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | void foo(ivec4 src_param[4]) { |
| 40 | ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)); |
dan sinclair | a01fd24 | 2023-12-05 20:23:42 +0000 | [diff] [blame] | 41 | ivec4 tint_symbol_4[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3)); |
| 42 | dst = tint_symbol_4; |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 43 | dst = src_param; |
| 44 | dst = ret_arr(); |
Ben Clayton | 19576e9 | 2022-06-28 12:44:16 +0000 | [diff] [blame] | 45 | ivec4 src_let[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 46 | dst = src_let; |
| 47 | dst = src_function; |
| 48 | dst = src_private; |
| 49 | dst = src_workgroup; |
dan sinclair | a01fd24 | 2023-12-05 20:23:42 +0000 | [diff] [blame] | 50 | S tint_symbol_1 = ret_struct_arr(); |
| 51 | dst = tint_symbol_1.arr; |
Stephen White | 863d9ed | 2022-09-02 19:19:10 +0000 | [diff] [blame] | 52 | dst = src_uniform.inner.arr; |
| 53 | dst = src_storage.inner.arr; |
Stephen White | 671d970 | 2022-01-21 18:40:18 +0000 | [diff] [blame] | 54 | int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0))); |
| 55 | dst_nested = src_nested; |
| 56 | } |
Stephen White | e2f35ba | 2022-01-26 16:48:55 +0000 | [diff] [blame] | 57 | |
dan sinclair | a01fd24 | 2023-12-05 20:23:42 +0000 | [diff] [blame] | 58 | void tint_symbol(uint local_invocation_index) { |
Ben Clayton | 9dc42ad | 2024-02-05 18:01:33 +0000 | [diff] [blame] | 59 | tint_zero_workgroup_memory(local_invocation_index); |
dan sinclair | a01fd24 | 2023-12-05 20:23:42 +0000 | [diff] [blame] | 60 | ivec4 a[4] = ivec4[4](ivec4(0), ivec4(0), ivec4(0), ivec4(0)); |
| 61 | foo(a); |
| 62 | } |
| 63 | |
| 64 | layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; |
| 65 | void main() { |
| 66 | tint_symbol(gl_LocalInvocationIndex); |
| 67 | return; |
| 68 | } |