blob: 646221afd575f49834e2f9dddf5cea8741410a0c [file] [log] [blame]
Ben Clayton009d1292022-02-04 15:39:34 +00001struct strided_arr {
2 float el;
3};
4struct strided_arr_1 {
5 strided_arr el[3][2];
6};
7
Peng Huangc00ff7f2023-03-31 17:55:19 +00008RWByteAddressBuffer s : register(u0);
Ben Clayton009d1292022-02-04 15:39:34 +00009
Ben Clayton1a1b5272023-02-24 17:16:55 +000010strided_arr s_load_4(uint offset) {
11 const strided_arr tint_symbol = {asfloat(s.Load((offset + 0u)))};
12 return tint_symbol;
Ben Clayton009d1292022-02-04 15:39:34 +000013}
14
Ben Clayton1a1b5272023-02-24 17:16:55 +000015typedef strided_arr s_load_3_ret[2];
16s_load_3_ret s_load_3(uint offset) {
Ben Clayton009d1292022-02-04 15:39:34 +000017 strided_arr arr[2] = (strided_arr[2])0;
18 {
Antonio Maiorano06844a52022-09-29 16:53:58 +000019 for(uint i = 0u; (i < 2u); i = (i + 1u)) {
Ben Clayton1a1b5272023-02-24 17:16:55 +000020 arr[i] = s_load_4((offset + (i * 8u)));
Ben Clayton009d1292022-02-04 15:39:34 +000021 }
22 }
23 return arr;
24}
25
Ben Clayton1a1b5272023-02-24 17:16:55 +000026typedef strided_arr s_load_2_ret[3][2];
27s_load_2_ret s_load_2(uint offset) {
Ben Clayton009d1292022-02-04 15:39:34 +000028 strided_arr arr_1[3][2] = (strided_arr[3][2])0;
29 {
Antonio Maiorano06844a52022-09-29 16:53:58 +000030 for(uint i_1 = 0u; (i_1 < 3u); i_1 = (i_1 + 1u)) {
Ben Clayton1a1b5272023-02-24 17:16:55 +000031 arr_1[i_1] = s_load_3((offset + (i_1 * 16u)));
Ben Clayton009d1292022-02-04 15:39:34 +000032 }
33 }
34 return arr_1;
35}
36
Ben Clayton1a1b5272023-02-24 17:16:55 +000037strided_arr_1 s_load_1(uint offset) {
38 const strided_arr_1 tint_symbol_1 = {s_load_2((offset + 0u))};
39 return tint_symbol_1;
Ben Clayton009d1292022-02-04 15:39:34 +000040}
41
Ben Clayton1a1b5272023-02-24 17:16:55 +000042typedef strided_arr_1 s_load_ret[4];
43s_load_ret s_load(uint offset) {
Ben Clayton009d1292022-02-04 15:39:34 +000044 strided_arr_1 arr_2[4] = (strided_arr_1[4])0;
45 {
Antonio Maiorano06844a52022-09-29 16:53:58 +000046 for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
Ben Clayton1a1b5272023-02-24 17:16:55 +000047 arr_2[i_2] = s_load_1((offset + (i_2 * 128u)));
Ben Clayton009d1292022-02-04 15:39:34 +000048 }
49 }
50 return arr_2;
51}
52
Ben Clayton1a1b5272023-02-24 17:16:55 +000053void s_store_4(uint offset, strided_arr value) {
54 s.Store((offset + 0u), asuint(value.el));
Ben Clayton009d1292022-02-04 15:39:34 +000055}
56
Ben Clayton1a1b5272023-02-24 17:16:55 +000057void s_store_3(uint offset, strided_arr value[2]) {
Ben Clayton971318f2023-02-14 13:52:43 +000058 strided_arr array_3[2] = value;
Ben Clayton009d1292022-02-04 15:39:34 +000059 {
Antonio Maiorano06844a52022-09-29 16:53:58 +000060 for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
Ben Clayton1a1b5272023-02-24 17:16:55 +000061 s_store_4((offset + (i_3 * 8u)), array_3[i_3]);
Ben Clayton009d1292022-02-04 15:39:34 +000062 }
63 }
64}
65
Ben Clayton1a1b5272023-02-24 17:16:55 +000066void s_store_2(uint offset, strided_arr value[3][2]) {
Ben Clayton971318f2023-02-14 13:52:43 +000067 strided_arr array_2[3][2] = value;
Ben Clayton009d1292022-02-04 15:39:34 +000068 {
Antonio Maiorano06844a52022-09-29 16:53:58 +000069 for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
Ben Clayton1a1b5272023-02-24 17:16:55 +000070 s_store_3((offset + (i_4 * 16u)), array_2[i_4]);
Ben Clayton009d1292022-02-04 15:39:34 +000071 }
72 }
73}
74
Ben Clayton1a1b5272023-02-24 17:16:55 +000075void s_store_1(uint offset, strided_arr_1 value) {
76 s_store_2((offset + 0u), value.el);
Ben Clayton009d1292022-02-04 15:39:34 +000077}
78
Ben Clayton1a1b5272023-02-24 17:16:55 +000079void s_store(uint offset, strided_arr_1 value[4]) {
Ben Clayton971318f2023-02-14 13:52:43 +000080 strided_arr_1 array_1[4] = value;
Ben Clayton009d1292022-02-04 15:39:34 +000081 {
Antonio Maiorano06844a52022-09-29 16:53:58 +000082 for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
Ben Clayton1a1b5272023-02-24 17:16:55 +000083 s_store_1((offset + (i_5 * 128u)), array_1[i_5]);
Ben Clayton009d1292022-02-04 15:39:34 +000084 }
85 }
86}
87
88void f_1() {
Ben Clayton1a1b5272023-02-24 17:16:55 +000089 const strided_arr_1 x_19[4] = s_load(0u);
90 const strided_arr x_24[3][2] = s_load_2(384u);
91 const strided_arr x_28[2] = s_load_3(416u);
Ben Clayton009d1292022-02-04 15:39:34 +000092 const float x_32 = asfloat(s.Load(424u));
Ben Clayton1a1b5272023-02-24 17:16:55 +000093 const strided_arr_1 tint_symbol_2[4] = (strided_arr_1[4])0;
94 s_store(0u, tint_symbol_2);
Ben Clayton009d1292022-02-04 15:39:34 +000095 s.Store(424u, asuint(5.0f));
96 return;
97}
98
99[numthreads(1, 1, 1)]
100void f() {
101 f_1();
102 return;
103}