writer/hlsl: Don't wrap arrays in structures

FXC has trouble dealing with these.
This was originally added to handle returning arrays as structures.
HLSL supports typedefs, which is a much simpiler solution, and doesn't upset FXC.

Bug: tint:848
Bug: tint:904
Change-Id: Ie841c9c454461a885a35c41476fd4d05d3f34cbf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/56774
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-07-05 15:20:57 +00:00
committed by Tint LUCI CQ
parent 106ac290e6
commit 4135ea55eb
41 changed files with 550 additions and 766 deletions

View File

@@ -6,36 +6,36 @@ void unused_entry_point() {
struct tint_padded_array_element {
int el;
};
struct tint_array_wrapper {
struct S {
tint_padded_array_element arr[4];
};
struct S {
tint_array_wrapper arr;
};
tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
typedef tint_padded_array_element tint_symbol_2_ret[4];
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
const uint scalar_offset = ((offset + 0u)) / 4;
const uint scalar_offset_1 = ((offset + 16u)) / 4;
const uint scalar_offset_2 = ((offset + 32u)) / 4;
const uint scalar_offset_3 = ((offset + 48u)) / 4;
const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
const tint_padded_array_element tint_symbol_5[4] = {{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}};
return tint_symbol_5;
}
tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_array_wrapper tint_symbol_6 = {{{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}}};
typedef tint_padded_array_element tint_symbol_4_ret[4];
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_padded_array_element tint_symbol_6[4] = {{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}};
return tint_symbol_6;
}
static tint_array_wrapper src_private = (tint_array_wrapper)0;
groupshared tint_array_wrapper src_workgroup;
static tint_padded_array_element src_private[4] = (tint_padded_array_element[4])0;
groupshared tint_padded_array_element src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
tint_array_wrapper ret_arr() {
const tint_array_wrapper tint_symbol_7 = {(tint_padded_array_element[4])0};
typedef tint_padded_array_element ret_arr_ret[4];
ret_arr_ret ret_arr() {
const tint_padded_array_element tint_symbol_7[4] = (tint_padded_array_element[4])0;
return tint_symbol_7;
}
@@ -44,24 +44,14 @@ S ret_struct_arr() {
return tint_symbol_8;
}
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
void foo(tint_array_wrapper src_param) {
tint_array_wrapper src_function = (tint_array_wrapper)0;
tint_array_wrapper tint_symbol = (tint_array_wrapper)0;
const tint_array_wrapper tint_symbol_9 = {{{1}, {2}, {3}, {3}}};
void foo(tint_padded_array_element src_param[4]) {
tint_padded_array_element src_function[4] = (tint_padded_array_element[4])0;
tint_padded_array_element tint_symbol[4] = (tint_padded_array_element[4])0;
const tint_padded_array_element tint_symbol_9[4] = {{1}, {2}, {3}, {3}};
tint_symbol = tint_symbol_9;
tint_symbol = src_param;
tint_symbol = ret_arr();
const tint_array_wrapper src_let = {(tint_padded_array_element[4])0};
const tint_padded_array_element src_let[4] = (tint_padded_array_element[4])0;
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
@@ -69,7 +59,7 @@ void foo(tint_array_wrapper src_param) {
tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_2(src_uniform, 0u);
tint_symbol = tint_symbol_4(src_storage, 0u);
tint_array_wrapper_1 dst_nested = (tint_array_wrapper_1)0;
tint_array_wrapper_1 src_nested = (tint_array_wrapper_1)0;
int dst_nested[4][3][2] = (int[4][3][2])0;
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}

View File

@@ -6,49 +6,38 @@ void unused_entry_point() {
struct tint_padded_array_element {
int el;
};
struct tint_array_wrapper {
struct S {
tint_padded_array_element arr[4];
};
struct S {
tint_array_wrapper arr;
};
tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
typedef tint_padded_array_element tint_symbol_2_ret[4];
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
const uint scalar_offset = ((offset + 0u)) / 4;
const uint scalar_offset_1 = ((offset + 16u)) / 4;
const uint scalar_offset_2 = ((offset + 32u)) / 4;
const uint scalar_offset_3 = ((offset + 48u)) / 4;
const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
const tint_padded_array_element tint_symbol_5[4] = {{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}};
return tint_symbol_5;
}
tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_array_wrapper tint_symbol_6 = {{{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}}};
typedef tint_padded_array_element tint_symbol_4_ret[4];
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_padded_array_element tint_symbol_6[4] = {{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}};
return tint_symbol_6;
}
static tint_array_wrapper src_private = (tint_array_wrapper)0;
groupshared tint_array_wrapper src_workgroup;
static tint_padded_array_element src_private[4] = (tint_padded_array_element[4])0;
groupshared tint_padded_array_element src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
static tint_array_wrapper tint_symbol = (tint_array_wrapper)0;
static tint_padded_array_element tint_symbol[4] = (tint_padded_array_element[4])0;
static int dst_nested[4][3][2] = (int[4][3][2])0;
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
static tint_array_wrapper_1 dst_nested = (tint_array_wrapper_1)0;
tint_array_wrapper ret_arr() {
const tint_array_wrapper tint_symbol_7 = {(tint_padded_array_element[4])0};
typedef tint_padded_array_element ret_arr_ret[4];
ret_arr_ret ret_arr() {
const tint_padded_array_element tint_symbol_7[4] = (tint_padded_array_element[4])0;
return tint_symbol_7;
}
@@ -57,13 +46,13 @@ S ret_struct_arr() {
return tint_symbol_8;
}
void foo(tint_array_wrapper src_param) {
tint_array_wrapper src_function = (tint_array_wrapper)0;
const tint_array_wrapper tint_symbol_9 = {{{1}, {2}, {3}, {3}}};
void foo(tint_padded_array_element src_param[4]) {
tint_padded_array_element src_function[4] = (tint_padded_array_element[4])0;
const tint_padded_array_element tint_symbol_9[4] = {{1}, {2}, {3}, {3}};
tint_symbol = tint_symbol_9;
tint_symbol = src_param;
tint_symbol = ret_arr();
const tint_array_wrapper src_let = {(tint_padded_array_element[4])0};
const tint_padded_array_element src_let[4] = (tint_padded_array_element[4])0;
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
@@ -71,6 +60,6 @@ void foo(tint_array_wrapper src_param) {
tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_2(src_uniform, 0u);
tint_symbol = tint_symbol_4(src_storage, 0u);
tint_array_wrapper_1 src_nested = (tint_array_wrapper_1)0;
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}

View File

@@ -6,64 +6,53 @@ void unused_entry_point() {
struct tint_padded_array_element {
int el;
};
struct tint_array_wrapper {
struct S {
tint_padded_array_element arr[4];
};
struct S {
tint_array_wrapper arr;
};
tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
typedef tint_padded_array_element tint_symbol_2_ret[4];
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
const uint scalar_offset = ((offset + 0u)) / 4;
const uint scalar_offset_1 = ((offset + 16u)) / 4;
const uint scalar_offset_2 = ((offset + 32u)) / 4;
const uint scalar_offset_3 = ((offset + 48u)) / 4;
const tint_array_wrapper tint_symbol_11 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
const tint_padded_array_element tint_symbol_11[4] = {{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}};
return tint_symbol_11;
}
tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_array_wrapper tint_symbol_12 = {{{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}}};
typedef tint_padded_array_element tint_symbol_4_ret[4];
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_padded_array_element tint_symbol_12[4] = {{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}};
return tint_symbol_12;
}
void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper value) {
buffer.Store((offset + 0u), asuint(value.arr[0u].el));
buffer.Store((offset + 16u), asuint(value.arr[1u].el));
buffer.Store((offset + 32u), asuint(value.arr[2u].el));
buffer.Store((offset + 48u), asuint(value.arr[3u].el));
void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, tint_padded_array_element value[4]) {
buffer.Store((offset + 0u), asuint(value[0u].el));
buffer.Store((offset + 16u), asuint(value[1u].el));
buffer.Store((offset + 32u), asuint(value[2u].el));
buffer.Store((offset + 48u), asuint(value[3u].el));
}
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_3 value) {
buffer.Store((offset + 0u), asuint(value.arr[0u]));
buffer.Store((offset + 4u), asuint(value.arr[1u]));
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[2]) {
buffer.Store((offset + 0u), asuint(value[0u]));
buffer.Store((offset + 4u), asuint(value[1u]));
}
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_2 value) {
tint_symbol_8(buffer, (offset + 0u), value.arr[0u]);
tint_symbol_8(buffer, (offset + 8u), value.arr[1u]);
tint_symbol_8(buffer, (offset + 16u), value.arr[2u]);
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
tint_symbol_8(buffer, (offset + 0u), value[0u]);
tint_symbol_8(buffer, (offset + 8u), value[1u]);
tint_symbol_8(buffer, (offset + 16u), value[2u]);
}
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_1 value) {
tint_symbol_9(buffer, (offset + 0u), value.arr[0u]);
tint_symbol_9(buffer, (offset + 24u), value.arr[1u]);
tint_symbol_9(buffer, (offset + 48u), value.arr[2u]);
tint_symbol_9(buffer, (offset + 72u), value.arr[3u]);
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
tint_symbol_9(buffer, (offset + 0u), value[0u]);
tint_symbol_9(buffer, (offset + 24u), value[1u]);
tint_symbol_9(buffer, (offset + 48u), value[2u]);
tint_symbol_9(buffer, (offset + 72u), value[3u]);
}
static tint_array_wrapper src_private = (tint_array_wrapper)0;
groupshared tint_array_wrapper src_workgroup;
static tint_padded_array_element src_private[4] = (tint_padded_array_element[4])0;
groupshared tint_padded_array_element src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
@@ -71,8 +60,9 @@ RWByteAddressBuffer src_storage : register(u1, space0);
RWByteAddressBuffer tint_symbol : register(u2, space0);
RWByteAddressBuffer dst_nested : register(u3, space0);
tint_array_wrapper ret_arr() {
const tint_array_wrapper tint_symbol_13 = {(tint_padded_array_element[4])0};
typedef tint_padded_array_element ret_arr_ret[4];
ret_arr_ret ret_arr() {
const tint_padded_array_element tint_symbol_13[4] = (tint_padded_array_element[4])0;
return tint_symbol_13;
}
@@ -81,13 +71,13 @@ S ret_struct_arr() {
return tint_symbol_14;
}
void foo(tint_array_wrapper src_param) {
tint_array_wrapper src_function = (tint_array_wrapper)0;
const tint_array_wrapper tint_symbol_15 = {{{1}, {2}, {3}, {3}}};
void foo(tint_padded_array_element src_param[4]) {
tint_padded_array_element src_function[4] = (tint_padded_array_element[4])0;
const tint_padded_array_element tint_symbol_15[4] = {{1}, {2}, {3}, {3}};
tint_symbol_6(tint_symbol, 0u, tint_symbol_15);
tint_symbol_6(tint_symbol, 0u, src_param);
tint_symbol_6(tint_symbol, 0u, ret_arr());
const tint_array_wrapper src_let = {(tint_padded_array_element[4])0};
const tint_padded_array_element src_let[4] = (tint_padded_array_element[4])0;
tint_symbol_6(tint_symbol, 0u, src_let);
tint_symbol_6(tint_symbol, 0u, src_function);
tint_symbol_6(tint_symbol, 0u, src_private);
@@ -95,6 +85,6 @@ void foo(tint_array_wrapper src_param) {
tint_symbol_6(tint_symbol, 0u, ret_struct_arr().arr);
tint_symbol_6(tint_symbol, 0u, tint_symbol_2(src_uniform, 0u));
tint_symbol_6(tint_symbol, 0u, tint_symbol_4(src_storage, 0u));
tint_array_wrapper_1 src_nested = (tint_array_wrapper_1)0;
int src_nested[4][3][2] = (int[4][3][2])0;
tint_symbol_10(dst_nested, 0u, src_nested);
}

View File

@@ -3,24 +3,18 @@ void unused_entry_point() {
return;
}
struct tint_array_wrapper {
int arr[4];
};
struct S {
tint_array_wrapper arr;
};
struct tint_array_wrapper_1 {
tint_array_wrapper arr[2];
int arr[4];
};
void foo() {
const tint_array_wrapper src = {(int[4])0};
tint_array_wrapper tint_symbol = (tint_array_wrapper)0;
const int src[4] = (int[4])0;
int tint_symbol[4] = (int[4])0;
S dst_struct = (S)0;
tint_array_wrapper_1 dst_array = (tint_array_wrapper_1)0;
int dst_array[2][4] = (int[2][4])0;
dst_struct.arr = src;
dst_array.arr[1] = src;
dst_array[1] = src;
tint_symbol = src;
dst_struct.arr = src;
dst_array.arr[0] = src;
dst_array[0] = src;
}

View File

@@ -6,49 +6,38 @@ void unused_entry_point() {
struct tint_padded_array_element {
int el;
};
struct tint_array_wrapper {
struct S {
tint_padded_array_element arr[4];
};
struct S {
tint_array_wrapper arr;
};
tint_array_wrapper tint_symbol_2(uint4 buffer[4], uint offset) {
typedef tint_padded_array_element tint_symbol_2_ret[4];
tint_symbol_2_ret tint_symbol_2(uint4 buffer[4], uint offset) {
const uint scalar_offset = ((offset + 0u)) / 4;
const uint scalar_offset_1 = ((offset + 16u)) / 4;
const uint scalar_offset_2 = ((offset + 32u)) / 4;
const uint scalar_offset_3 = ((offset + 48u)) / 4;
const tint_array_wrapper tint_symbol_5 = {{{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}}};
const tint_padded_array_element tint_symbol_5[4] = {{asint(buffer[scalar_offset / 4][scalar_offset % 4])}, {asint(buffer[scalar_offset_1 / 4][scalar_offset_1 % 4])}, {asint(buffer[scalar_offset_2 / 4][scalar_offset_2 % 4])}, {asint(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4])}};
return tint_symbol_5;
}
tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_array_wrapper tint_symbol_6 = {{{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}}};
typedef tint_padded_array_element tint_symbol_4_ret[4];
tint_symbol_4_ret tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const tint_padded_array_element tint_symbol_6[4] = {{asint(buffer.Load((offset + 0u)))}, {asint(buffer.Load((offset + 16u)))}, {asint(buffer.Load((offset + 32u)))}, {asint(buffer.Load((offset + 48u)))}};
return tint_symbol_6;
}
static tint_array_wrapper src_private = (tint_array_wrapper)0;
groupshared tint_array_wrapper src_workgroup;
static tint_padded_array_element src_private[4] = (tint_padded_array_element[4])0;
groupshared tint_padded_array_element src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
groupshared tint_array_wrapper tint_symbol;
groupshared tint_padded_array_element tint_symbol[4];
groupshared int dst_nested[4][3][2];
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
groupshared tint_array_wrapper_1 dst_nested;
tint_array_wrapper ret_arr() {
const tint_array_wrapper tint_symbol_7 = {(tint_padded_array_element[4])0};
typedef tint_padded_array_element ret_arr_ret[4];
ret_arr_ret ret_arr() {
const tint_padded_array_element tint_symbol_7[4] = (tint_padded_array_element[4])0;
return tint_symbol_7;
}
@@ -57,13 +46,13 @@ S ret_struct_arr() {
return tint_symbol_8;
}
void foo(tint_array_wrapper src_param) {
tint_array_wrapper src_function = (tint_array_wrapper)0;
const tint_array_wrapper tint_symbol_9 = {{{1}, {2}, {3}, {3}}};
void foo(tint_padded_array_element src_param[4]) {
tint_padded_array_element src_function[4] = (tint_padded_array_element[4])0;
const tint_padded_array_element tint_symbol_9[4] = {{1}, {2}, {3}, {3}};
tint_symbol = tint_symbol_9;
tint_symbol = src_param;
tint_symbol = ret_arr();
const tint_array_wrapper src_let = {(tint_padded_array_element[4])0};
const tint_padded_array_element src_let[4] = (tint_padded_array_element[4])0;
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
@@ -71,6 +60,6 @@ void foo(tint_array_wrapper src_param) {
tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_2(src_uniform, 0u);
tint_symbol = tint_symbol_4(src_storage, 0u);
tint_array_wrapper_1 src_nested = (tint_array_wrapper_1)0;
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}

View File

@@ -1,32 +1,20 @@
struct tint_array_wrapper {
float arr[4];
};
float f1(tint_array_wrapper a) {
return a.arr[3];
float f1(float a[4]) {
return a[3];
}
struct tint_array_wrapper_1 {
tint_array_wrapper arr[3];
};
float f2(tint_array_wrapper_1 a) {
return a.arr[2].arr[3];
float f2(float a[3][4]) {
return a[2][3];
}
struct tint_array_wrapper_2 {
tint_array_wrapper_1 arr[2];
};
float f3(tint_array_wrapper_2 a) {
return a.arr[1].arr[2].arr[3];
float f3(float a[2][3][4]) {
return a[1][2][3];
}
[numthreads(1, 1, 1)]
void main() {
const tint_array_wrapper a1 = {(float[4])0};
const tint_array_wrapper_1 a2 = {(tint_array_wrapper[3])0};
const tint_array_wrapper_2 a3 = {(tint_array_wrapper_1[2])0};
const float a1[4] = (float[4])0;
const float a2[3][4] = (float[3][4])0;
const float a3[2][3][4] = (float[2][3][4])0;
const float v1 = f1(a1);
const float v2 = f2(a2);
const float v3 = f3(a3);

View File

@@ -1,34 +1,25 @@
struct tint_array_wrapper {
float arr[4];
};
tint_array_wrapper f1() {
const tint_array_wrapper tint_symbol = {(float[4])0};
typedef float f1_ret[4];
f1_ret f1() {
const float tint_symbol[4] = (float[4])0;
return tint_symbol;
}
struct tint_array_wrapper_1 {
tint_array_wrapper arr[3];
};
tint_array_wrapper_1 f2() {
const tint_array_wrapper_1 tint_symbol_1 = {{f1(), f1(), f1()}};
typedef float f2_ret[3][4];
f2_ret f2() {
const float tint_symbol_1[3][4] = {f1(), f1(), f1()};
return tint_symbol_1;
}
struct tint_array_wrapper_2 {
tint_array_wrapper_1 arr[2];
};
tint_array_wrapper_2 f3() {
const tint_array_wrapper_2 tint_symbol_2 = {{f2(), f2()}};
typedef float f3_ret[2][3][4];
f3_ret f3() {
const float tint_symbol_2[2][3][4] = {f2(), f2()};
return tint_symbol_2;
}
[numthreads(1, 1, 1)]
void main() {
const tint_array_wrapper a1 = f1();
const tint_array_wrapper_1 a2 = f2();
const tint_array_wrapper_2 a3 = f3();
const float a1[4] = f1();
const float a2[3][4] = f2();
const float a3[2][3][4] = f3();
return;
}

View File

@@ -1,50 +1,37 @@
struct tint_array_wrapper {
int arr[4];
};
struct tint_array_wrapper_2 {
tint_array_wrapper arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[2];
};
struct tint_array_wrapper_3 {
tint_array_wrapper arr[2];
};
[numthreads(1, 1, 1)]
void main() {
const int x = 42;
const tint_array_wrapper empty = {(int[4])0};
const tint_array_wrapper nonempty = {{1, 2, 3, 4}};
const tint_array_wrapper nonempty_with_expr = {{1, x, (x + 1), nonempty.arr[3]}};
const tint_array_wrapper_1 nested_empty = {(tint_array_wrapper_2[2])0};
const tint_array_wrapper tint_symbol = {{1, 2, 3, 4}};
const tint_array_wrapper tint_symbol_1 = {{5, 6, 7, 8}};
const tint_array_wrapper tint_symbol_2 = {{9, 10, 11, 12}};
const tint_array_wrapper_2 tint_symbol_3 = {{tint_symbol, tint_symbol_1, tint_symbol_2}};
const tint_array_wrapper tint_symbol_4 = {{13, 14, 15, 16}};
const tint_array_wrapper tint_symbol_5 = {{17, 18, 19, 20}};
const tint_array_wrapper tint_symbol_6 = {{21, 22, 23, 24}};
const tint_array_wrapper_2 tint_symbol_7 = {{tint_symbol_4, tint_symbol_5, tint_symbol_6}};
const tint_array_wrapper_1 nested_nonempty = {{tint_symbol_3, tint_symbol_7}};
const tint_array_wrapper tint_symbol_8 = {{1, 2, x, (x + 1)}};
const tint_array_wrapper tint_symbol_9 = {{5, 6, nonempty.arr[2], (nonempty.arr[3] + 1)}};
const tint_array_wrapper_2 tint_symbol_10 = {{tint_symbol_8, tint_symbol_9, nonempty}};
const tint_array_wrapper_1 nested_nonempty_with_expr = {{tint_symbol_10, nested_nonempty.arr[1]}};
const tint_array_wrapper tint_symbol_11 = {(int[4])0};
const int subexpr_empty = tint_symbol_11.arr[1];
const tint_array_wrapper tint_symbol_12 = {{1, 2, 3, 4}};
const int subexpr_nonempty = tint_symbol_12.arr[2];
const tint_array_wrapper tint_symbol_13 = {{1, x, (x + 1), nonempty.arr[3]}};
const int subexpr_nonempty_with_expr = tint_symbol_13.arr[2];
const tint_array_wrapper_3 tint_symbol_14 = {(tint_array_wrapper[2])0};
const tint_array_wrapper subexpr_nested_empty = tint_symbol_14.arr[1];
const tint_array_wrapper tint_symbol_15 = {{1, 2, 3, 4}};
const tint_array_wrapper tint_symbol_16 = {{5, 6, 7, 8}};
const tint_array_wrapper_3 tint_symbol_17 = {{tint_symbol_15, tint_symbol_16}};
const tint_array_wrapper subexpr_nested_nonempty = tint_symbol_17.arr[1];
const tint_array_wrapper tint_symbol_18 = {{1, x, (x + 1), nonempty.arr[3]}};
const tint_array_wrapper_3 tint_symbol_19 = {{tint_symbol_18, nested_nonempty.arr[1].arr[2]}};
const tint_array_wrapper subexpr_nested_nonempty_with_expr = tint_symbol_19.arr[1];
const int empty[4] = (int[4])0;
const int nonempty[4] = {1, 2, 3, 4};
const int nonempty_with_expr[4] = {1, x, (x + 1), nonempty[3]};
const int nested_empty[2][3][4] = (int[2][3][4])0;
const int tint_symbol[4] = {1, 2, 3, 4};
const int tint_symbol_1[4] = {5, 6, 7, 8};
const int tint_symbol_2[4] = {9, 10, 11, 12};
const int tint_symbol_3[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2};
const int tint_symbol_4[4] = {13, 14, 15, 16};
const int tint_symbol_5[4] = {17, 18, 19, 20};
const int tint_symbol_6[4] = {21, 22, 23, 24};
const int tint_symbol_7[3][4] = {tint_symbol_4, tint_symbol_5, tint_symbol_6};
const int nested_nonempty[2][3][4] = {tint_symbol_3, tint_symbol_7};
const int tint_symbol_8[4] = {1, 2, x, (x + 1)};
const int tint_symbol_9[4] = {5, 6, nonempty[2], (nonempty[3] + 1)};
const int tint_symbol_10[3][4] = {tint_symbol_8, tint_symbol_9, nonempty};
const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, nested_nonempty[1]};
const int tint_symbol_11[4] = (int[4])0;
const int subexpr_empty = tint_symbol_11[1];
const int tint_symbol_12[4] = {1, 2, 3, 4};
const int subexpr_nonempty = tint_symbol_12[2];
const int tint_symbol_13[4] = {1, x, (x + 1), nonempty[3]};
const int subexpr_nonempty_with_expr = tint_symbol_13[2];
const int tint_symbol_14[2][4] = (int[2][4])0;
const int subexpr_nested_empty[4] = tint_symbol_14[1];
const int tint_symbol_15[4] = {1, 2, 3, 4};
const int tint_symbol_16[4] = {5, 6, 7, 8};
const int tint_symbol_17[2][4] = {tint_symbol_15, tint_symbol_16};
const int subexpr_nested_nonempty[4] = tint_symbol_17[1];
const int tint_symbol_18[4] = {1, x, (x + 1), nonempty[3]};
const int tint_symbol_19[2][4] = {tint_symbol_18, nested_nonempty[1][2]};
const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1];
return;
}