blob: 3e91089db4b6c78347701d967f8be72f50be77e1 [file] [log] [blame]
Ben Clayton9dc42ad2024-02-05 18:01:33 +00001groupshared int4 tint_symbol[4];
2groupshared int4 src_workgroup[4];
3groupshared int dst_nested[4][3][2];
4
5void tint_zero_workgroup_memory(uint local_idx) {
6 {
7 for(uint idx = local_idx; (idx < 4u); idx = (idx + 1u)) {
8 uint i = idx;
9 tint_symbol[i] = (0).xxxx;
10 src_workgroup[i] = (0).xxxx;
11 }
12 }
13 {
14 for(uint idx_1 = local_idx; (idx_1 < 24u); idx_1 = (idx_1 + 1u)) {
15 uint i_1 = (idx_1 / 6u);
16 uint i_2 = ((idx_1 % 6u) / 2u);
17 uint i_3 = (idx_1 % 2u);
18 dst_nested[i_1][i_2][i_3] = 0;
19 }
20 }
21 GroupMemoryBarrierWithGroupSync();
22}
23
Ben Clayton4135ea52021-07-05 15:20:57 +000024struct S {
James Pricef6e5cc02022-01-20 22:11:07 +000025 int4 arr[4];
Ben Clayton5d2f34e2021-06-16 09:19:36 +000026};
27
James Pricef6e5cc02022-01-20 22:11:07 +000028static int4 src_private[4] = (int4[4])0;
Peng Huangc00ff7f2023-03-31 17:55:19 +000029cbuffer cbuffer_src_uniform : register(b0) {
Ben Clayton165512c2021-06-18 21:15:25 +000030 uint4 src_uniform[4];
31};
Peng Huangc00ff7f2023-03-31 17:55:19 +000032RWByteAddressBuffer src_storage : register(u1);
Ben Clayton5d2f34e2021-06-16 09:19:36 +000033
James Pricef6e5cc02022-01-20 22:11:07 +000034typedef int4 ret_arr_ret[4];
Ben Clayton4135ea52021-07-05 15:20:57 +000035ret_arr_ret ret_arr() {
Antonio Maiorano144ebed2024-01-30 16:30:15 +000036 int4 tint_symbol_4[4] = (int4[4])0;
dan sinclaira01fd242023-12-05 20:23:42 +000037 return tint_symbol_4;
Ben Clayton8a96c782021-07-15 20:29:09 +000038}
39
Antonio Maiorano93baaae2022-03-15 15:35:13 +000040S ret_struct_arr() {
Antonio Maiorano144ebed2024-01-30 16:30:15 +000041 S tint_symbol_5 = (S)0;
dan sinclaira01fd242023-12-05 20:23:42 +000042 return tint_symbol_5;
Antonio Maiorano93baaae2022-03-15 15:35:13 +000043}
44
Ben Clayton1a1b5272023-02-24 17:16:55 +000045typedef int4 src_uniform_load_ret[4];
46src_uniform_load_ret src_uniform_load(uint offset) {
James Pricef6e5cc02022-01-20 22:11:07 +000047 int4 arr_1[4] = (int4[4])0;
Ben Clayton883fb632021-07-16 19:47:44 +000048 {
dan sinclaira01fd242023-12-05 20:23:42 +000049 for(uint i_4 = 0u; (i_4 < 4u); i_4 = (i_4 + 1u)) {
50 const uint scalar_offset = ((offset + (i_4 * 16u))) / 4;
51 arr_1[i_4] = asint(src_uniform[scalar_offset / 4]);
Ben Clayton883fb632021-07-16 19:47:44 +000052 }
53 }
54 return arr_1;
Ben Clayton8a96c782021-07-15 20:29:09 +000055}
56
Ben Clayton1a1b5272023-02-24 17:16:55 +000057typedef int4 src_storage_load_ret[4];
58src_storage_load_ret src_storage_load(uint offset) {
James Pricef6e5cc02022-01-20 22:11:07 +000059 int4 arr_2[4] = (int4[4])0;
Ben Clayton883fb632021-07-16 19:47:44 +000060 {
dan sinclaira01fd242023-12-05 20:23:42 +000061 for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
62 arr_2[i_5] = asint(src_storage.Load4((offset + (i_5 * 16u))));
Ben Clayton883fb632021-07-16 19:47:44 +000063 }
64 }
65 return arr_2;
Ben Clayton5d2f34e2021-06-16 09:19:36 +000066}
Ben Clayton9ef52ff2021-06-16 09:19:36 +000067
James Pricef6e5cc02022-01-20 22:11:07 +000068void foo(int4 src_param[4]) {
69 int4 src_function[4] = (int4[4])0;
Antonio Maiorano144ebed2024-01-30 16:30:15 +000070 int4 tint_symbol_6[4] = {(1).xxxx, (2).xxxx, (3).xxxx, (3).xxxx};
dan sinclaira01fd242023-12-05 20:23:42 +000071 tint_symbol = tint_symbol_6;
Ben Clayton5d2f34e2021-06-16 09:19:36 +000072 tint_symbol = src_param;
73 tint_symbol = ret_arr();
Antonio Maiorano144ebed2024-01-30 16:30:15 +000074 int4 src_let[4] = (int4[4])0;
Ben Clayton5d2f34e2021-06-16 09:19:36 +000075 tint_symbol = src_let;
76 tint_symbol = src_function;
77 tint_symbol = src_private;
78 tint_symbol = src_workgroup;
Antonio Maiorano144ebed2024-01-30 16:30:15 +000079 S tint_symbol_1 = ret_struct_arr();
Antonio Maiorano93baaae2022-03-15 15:35:13 +000080 tint_symbol = tint_symbol_1.arr;
Ben Clayton1a1b5272023-02-24 17:16:55 +000081 tint_symbol = src_uniform_load(0u);
82 tint_symbol = src_storage_load(0u);
Ben Clayton4135ea52021-07-05 15:20:57 +000083 int src_nested[4][3][2] = (int[4][3][2])0;
Ben Clayton5d2f34e2021-06-16 09:19:36 +000084 dst_nested = src_nested;
85}
dan sinclaira01fd242023-12-05 20:23:42 +000086
87struct tint_symbol_3 {
88 uint local_invocation_index : SV_GroupIndex;
89};
90
91void main_inner(uint local_invocation_index) {
Ben Clayton9dc42ad2024-02-05 18:01:33 +000092 tint_zero_workgroup_memory(local_invocation_index);
Antonio Maiorano144ebed2024-01-30 16:30:15 +000093 int4 val[4] = (int4[4])0;
dan sinclaira01fd242023-12-05 20:23:42 +000094 foo(val);
95}
96
97[numthreads(1, 1, 1)]
98void main(tint_symbol_3 tint_symbol_2) {
99 main_inner(tint_symbol_2.local_invocation_index);
100 return;
101}