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

@ -28,7 +28,6 @@
#include "src/transform/pad_array_elements.h" #include "src/transform/pad_array_elements.h"
#include "src/transform/promote_initializers_to_const_var.h" #include "src/transform/promote_initializers_to_const_var.h"
#include "src/transform/simplify.h" #include "src/transform/simplify.h"
#include "src/transform/wrap_arrays_in_structs.h"
#include "src/transform/zero_init_workgroup_memory.h" #include "src/transform/zero_init_workgroup_memory.h"
TINT_INSTANTIATE_TYPEINFO(tint::transform::Hlsl); TINT_INSTANTIATE_TYPEINFO(tint::transform::Hlsl);
@ -66,7 +65,6 @@ Output Hlsl::Run(const Program* in, const DataMap&) {
manager.Add<CalculateArrayLength>(); manager.Add<CalculateArrayLength>();
manager.Add<ExternalTextureTransform>(); manager.Add<ExternalTextureTransform>();
manager.Add<PromoteInitializersToConstVar>(); manager.Add<PromoteInitializersToConstVar>();
manager.Add<WrapArraysInStructs>();
manager.Add<PadArrayElements>(); manager.Add<PadArrayElements>();
data.Add<CanonicalizeEntryPointIO::Config>( data.Add<CanonicalizeEntryPointIO::Config>(
CanonicalizeEntryPointIO::BuiltinStyle::kStructMember); CanonicalizeEntryPointIO::BuiltinStyle::kStructMember);

View File

@ -2109,12 +2109,27 @@ bool GeneratorImpl::EmitFunction(ast::Function* func) {
{ {
auto out = line(); auto out = line();
auto name = builder_.Symbols().NameFor(func->symbol());
// If the function returns an array, then we need to declare a typedef for
// this.
if (sem->ReturnType()->Is<sem::Array>()) {
auto typedef_name = UniqueIdentifier(name + "_ret");
auto pre = line();
pre << "typedef ";
if (!EmitTypeAndName(pre, sem->ReturnType(), ast::StorageClass::kNone,
ast::Access::kReadWrite, typedef_name)) {
return false;
}
pre << ";";
out << typedef_name;
} else {
if (!EmitType(out, sem->ReturnType(), ast::StorageClass::kNone, if (!EmitType(out, sem->ReturnType(), ast::StorageClass::kNone,
ast::Access::kReadWrite, "")) { ast::Access::kReadWrite, "")) {
return false; return false;
} }
}
out << " " << builder_.Symbols().NameFor(func->symbol()) << "("; out << " " << name << "(";
bool first = true; bool first = true;

View File

@ -755,18 +755,13 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
Return(), Return(),
}); });
GeneratorImpl& gen = SanitizeAndBuild(); GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_THAT(gen.result(), HasSubstr(R"( EXPECT_EQ(gen.result(), R"(void my_func(float a[5]) {
struct tint_array_wrapper {
float arr[5];
};
void my_func(tint_array_wrapper a) {
return; return;
} }
)")); )");
} }
TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayReturn) { TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayReturn) {
@ -775,19 +770,14 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayReturn) {
Return(Construct(ty.array<f32, 5>())), Return(Construct(ty.array<f32, 5>())),
}); });
GeneratorImpl& gen = SanitizeAndBuild(); GeneratorImpl& gen = Build();
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_THAT(gen.result(), HasSubstr(R"( EXPECT_EQ(gen.result(), R"(typedef float my_func_ret[5];
struct tint_array_wrapper { my_func_ret my_func() {
float arr[5]; return (float[5])0;
};
tint_array_wrapper my_func() {
const tint_array_wrapper tint_symbol = {(float[5])0};
return tint_symbol;
} }
)")); )");
} }
// https://crbug.com/tint/297 // https://crbug.com/tint/297

View File

@ -162,13 +162,9 @@ TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) {
ASSERT_TRUE(gen.Generate()) << gen.error(); ASSERT_TRUE(gen.Generate()) << gen.error();
auto got = gen.result(); auto got = gen.result();
auto* expect = R"(struct tint_array_wrapper { auto* expect = R"(void main() {
int arr[4]; const int tint_symbol[4] = {1, 2, 3, 4};
}; int pos = tint_symbol[3];
void main() {
const tint_array_wrapper tint_symbol = {{1, 2, 3, 4}};
int pos = tint_symbol.arr[3];
return; return;
} }
)"; )";

View File

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

View File

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

View File

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

View File

@ -3,24 +3,18 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
int arr[4];
};
struct S { struct S {
tint_array_wrapper arr; int arr[4];
};
struct tint_array_wrapper_1 {
tint_array_wrapper arr[2];
}; };
void foo() { void foo() {
const tint_array_wrapper src = {(int[4])0}; const int src[4] = (int[4])0;
tint_array_wrapper tint_symbol = (tint_array_wrapper)0; int tint_symbol[4] = (int[4])0;
S dst_struct = (S)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_struct.arr = src;
dst_array.arr[1] = src; dst_array[1] = src;
tint_symbol = src; tint_symbol = src;
dst_struct.arr = 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 { struct tint_padded_array_element {
int el; int el;
}; };
struct tint_array_wrapper { struct S {
tint_padded_array_element arr[4]; 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 = ((offset + 0u)) / 4;
const uint scalar_offset_1 = ((offset + 16u)) / 4; const uint scalar_offset_1 = ((offset + 16u)) / 4;
const uint scalar_offset_2 = ((offset + 32u)) / 4; const uint scalar_offset_2 = ((offset + 32u)) / 4;
const uint scalar_offset_3 = ((offset + 48u)) / 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; return tint_symbol_5;
} }
tint_array_wrapper tint_symbol_4(RWByteAddressBuffer buffer, uint offset) { typedef tint_padded_array_element tint_symbol_4_ret[4];
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)))}}}; 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; return tint_symbol_6;
} }
static tint_array_wrapper src_private = (tint_array_wrapper)0; static tint_padded_array_element src_private[4] = (tint_padded_array_element[4])0;
groupshared tint_array_wrapper src_workgroup; groupshared tint_padded_array_element src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) { cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4]; uint4 src_uniform[4];
}; };
RWByteAddressBuffer src_storage : register(u1, space0); 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 { typedef tint_padded_array_element ret_arr_ret[4];
int arr[2]; ret_arr_ret ret_arr() {
}; const tint_padded_array_element tint_symbol_7[4] = (tint_padded_array_element[4])0;
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};
return tint_symbol_7; return tint_symbol_7;
} }
@ -57,13 +46,13 @@ S ret_struct_arr() {
return tint_symbol_8; return tint_symbol_8;
} }
void foo(tint_array_wrapper src_param) { void foo(tint_padded_array_element src_param[4]) {
tint_array_wrapper src_function = (tint_array_wrapper)0; tint_padded_array_element src_function[4] = (tint_padded_array_element[4])0;
const tint_array_wrapper tint_symbol_9 = {{{1}, {2}, {3}, {3}}}; const tint_padded_array_element tint_symbol_9[4] = {{1}, {2}, {3}, {3}};
tint_symbol = tint_symbol_9; tint_symbol = tint_symbol_9;
tint_symbol = src_param; tint_symbol = src_param;
tint_symbol = ret_arr(); 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_let;
tint_symbol = src_function; tint_symbol = src_function;
tint_symbol = src_private; tint_symbol = src_private;
@ -71,6 +60,6 @@ void foo(tint_array_wrapper src_param) {
tint_symbol = ret_struct_arr().arr; tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_2(src_uniform, 0u); tint_symbol = tint_symbol_2(src_uniform, 0u);
tint_symbol = tint_symbol_4(src_storage, 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; dst_nested = src_nested;
} }

View File

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

View File

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

View File

@ -13,15 +13,12 @@ struct tint_symbol_2 {
float2 texcoords : TEXCOORD0; float2 texcoords : TEXCOORD0;
float4 position : SV_Position; float4 position : SV_Position;
}; };
struct tint_array_wrapper {
float2 arr[3];
};
tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) { tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) {
const uint VertexIndex = tint_symbol.VertexIndex; const uint VertexIndex = tint_symbol.VertexIndex;
tint_array_wrapper texcoord = {{float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)}}; float2 texcoord[3] = {float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)};
VertexOutputs output = (VertexOutputs)0; VertexOutputs output = (VertexOutputs)0;
output.position = float4(((texcoord.arr[VertexIndex] * 2.0f) - float2(1.0f, 1.0f)), 0.0f, 1.0f); output.position = float4(((texcoord[VertexIndex] * 2.0f) - float2(1.0f, 1.0f)), 0.0f, 1.0f);
const uint scalar_offset = (4u) / 4; const uint scalar_offset = (4u) / 4;
bool flipY = (asfloat(uniforms[scalar_offset / 4][scalar_offset % 4]) < 0.0f); bool flipY = (asfloat(uniforms[scalar_offset / 4][scalar_offset % 4]) < 0.0f);
if (flipY) { if (flipY) {
@ -29,13 +26,13 @@ tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) {
uint4 ubo_load = uniforms[scalar_offset_1 / 4]; uint4 ubo_load = uniforms[scalar_offset_1 / 4];
const uint scalar_offset_2 = (8u) / 4; const uint scalar_offset_2 = (8u) / 4;
uint4 ubo_load_1 = uniforms[scalar_offset_2 / 4]; uint4 ubo_load_1 = uniforms[scalar_offset_2 / 4];
output.texcoords = ((((texcoord.arr[VertexIndex] * asfloat(((scalar_offset_1 & 2) ? ubo_load.zw : ubo_load.xy))) + asfloat(((scalar_offset_2 & 2) ? ubo_load_1.zw : ubo_load_1.xy))) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)); output.texcoords = ((((texcoord[VertexIndex] * asfloat(((scalar_offset_1 & 2) ? ubo_load.zw : ubo_load.xy))) + asfloat(((scalar_offset_2 & 2) ? ubo_load_1.zw : ubo_load_1.xy))) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f));
} else { } else {
const uint scalar_offset_3 = (0u) / 4; const uint scalar_offset_3 = (0u) / 4;
uint4 ubo_load_2 = uniforms[scalar_offset_3 / 4]; uint4 ubo_load_2 = uniforms[scalar_offset_3 / 4];
const uint scalar_offset_4 = (8u) / 4; const uint scalar_offset_4 = (8u) / 4;
uint4 ubo_load_3 = uniforms[scalar_offset_4 / 4]; uint4 ubo_load_3 = uniforms[scalar_offset_4 / 4];
output.texcoords = ((((texcoord.arr[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(((scalar_offset_3 & 2) ? ubo_load_2.zw : ubo_load_2.xy))) + asfloat(((scalar_offset_4 & 2) ? ubo_load_3.zw : ubo_load_3.xy))); output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(((scalar_offset_3 & 2) ? ubo_load_2.zw : ubo_load_2.xy))) + asfloat(((scalar_offset_4 & 2) ? ubo_load_3.zw : ubo_load_3.xy)));
} }
const tint_symbol_2 tint_symbol_8 = {output.texcoords, output.position}; const tint_symbol_2 tint_symbol_8 = {output.texcoords, output.position};
return tint_symbol_8; return tint_symbol_8;

View File

@ -27,19 +27,16 @@ struct tint_symbol_1 {
struct tint_symbol_2 { struct tint_symbol_2 {
float4 value : SV_Position; float4 value : SV_Position;
}; };
struct tint_array_wrapper {
float2 arr[3];
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) { tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const uint gl_VertexIndex = tint_symbol.gl_VertexIndex; const uint gl_VertexIndex = tint_symbol.gl_VertexIndex;
tint_array_wrapper indexable = (tint_array_wrapper)0; float2 indexable[3] = (float2[3])0;
const float2x2 x_23 = tint_symbol_4(x_20, 0u); const float2x2 x_23 = tint_symbol_4(x_20, 0u);
const float2x2 x_28 = tint_symbol_6(x_26, 0u); const float2x2 x_28 = tint_symbol_6(x_26, 0u);
const uint x_46 = gl_VertexIndex; const uint x_46 = gl_VertexIndex;
const tint_array_wrapper tint_symbol_7 = {{float2(-1.0f, 1.0f), float2(1.0f, 1.0f), float2(-1.0f, -1.0f)}}; const float2 tint_symbol_7[3] = {float2(-1.0f, 1.0f), float2(1.0f, 1.0f), float2(-1.0f, -1.0f)};
indexable = tint_symbol_7; indexable = tint_symbol_7;
const float2 x_51 = indexable.arr[x_46]; const float2 x_51 = indexable[x_46];
const float2 x_52 = mul(x_51, float2x2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u]))); const float2 x_52 = mul(x_51, float2x2((x_23[0u] + x_28[0u]), (x_23[1u] + x_28[1u])));
const tint_symbol_2 tint_symbol_8 = {float4(x_52.x, x_52.y, 0.0f, 1.0f)}; const tint_symbol_2 tint_symbol_8 = {float4(x_52.x, x_52.y, 0.0f, 1.0f)};
return tint_symbol_8; return tint_symbol_8;

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,8 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
int arr[2];
};
void foo() { void foo() {
tint_array_wrapper tint_symbol = (tint_array_wrapper)0; int tint_symbol[2] = (int[2])0;
tint_array_wrapper implict = (tint_array_wrapper)0; int implict[2] = (int[2])0;
implict = tint_symbol; implict = tint_symbol;
} }

View File

@ -10,22 +10,16 @@ struct tint_symbol_2 {
float4 color : TEXCOORD0; float4 color : TEXCOORD0;
float4 Position : SV_Position; float4 Position : SV_Position;
}; };
struct tint_array_wrapper {
float2 arr[4];
};
struct tint_array_wrapper_1 {
float4 arr[4];
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) { tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const uint VertexIndex = tint_symbol.VertexIndex; const uint VertexIndex = tint_symbol.VertexIndex;
const uint InstanceIndex = tint_symbol.InstanceIndex; const uint InstanceIndex = tint_symbol.InstanceIndex;
tint_array_wrapper zv = {{float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)}}; float2 zv[4] = {float2(0.200000003f, 0.200000003f), float2(0.300000012f, 0.300000012f), float2(-0.100000001f, -0.100000001f), float2(1.100000024f, 1.100000024f)};
const float z = zv.arr[InstanceIndex].x; const float z = zv[InstanceIndex].x;
Output output = (Output)0; Output output = (Output)0;
output.Position = float4(0.5f, 0.5f, z, 1.0f); output.Position = float4(0.5f, 0.5f, z, 1.0f);
tint_array_wrapper_1 colors = {{float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}}; float4 colors[4] = {float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)};
output.color = colors.arr[InstanceIndex]; output.color = colors[InstanceIndex];
const tint_symbol_2 tint_symbol_3 = {output.color, output.Position}; const tint_symbol_2 tint_symbol_3 = {output.color, output.Position};
return tint_symbol_3; return tint_symbol_3;
} }

View File

@ -1,23 +1,20 @@
struct tint_array_wrapper { typedef int tint_symbol_1_ret[6];
int arr[6]; tint_symbol_1_ret tint_symbol_1(ByteAddressBuffer buffer, uint offset) {
}; const int tint_symbol_2[6] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 4u))), asint(buffer.Load((offset + 8u))), asint(buffer.Load((offset + 12u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 20u)))};
tint_array_wrapper tint_symbol_1(ByteAddressBuffer buffer, uint offset) {
const tint_array_wrapper tint_symbol_2 = {{asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 4u))), asint(buffer.Load((offset + 8u))), asint(buffer.Load((offset + 12u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 20u)))}};
return tint_symbol_2; return tint_symbol_2;
} }
ByteAddressBuffer sspp962805860buildInformation : register(t2, space0); ByteAddressBuffer sspp962805860buildInformation : register(t2, space0);
void main_1() { void main_1() {
tint_array_wrapper orientation = (tint_array_wrapper)0; int orientation[6] = (int[6])0;
const tint_array_wrapper x_23 = tint_symbol_1(sspp962805860buildInformation, 36u); const int x_23[6] = tint_symbol_1(sspp962805860buildInformation, 36u);
orientation.arr[0] = x_23.arr[0u]; orientation[0] = x_23[0u];
orientation.arr[1] = x_23.arr[1u]; orientation[1] = x_23[1u];
orientation.arr[2] = x_23.arr[2u]; orientation[2] = x_23[2u];
orientation.arr[3] = x_23.arr[3u]; orientation[3] = x_23[3u];
orientation.arr[4] = x_23.arr[4u]; orientation[4] = x_23[4u];
orientation.arr[5] = x_23.arr[5u]; orientation[5] = x_23[5u];
return; return;
} }

View File

@ -54,28 +54,14 @@ static const uint ColPerThread = 4u;
static const uint TileAOuter = 64u; static const uint TileAOuter = 64u;
static const uint TileBOuter = 64u; static const uint TileBOuter = 64u;
static const uint TileInner = 64u; static const uint TileInner = 64u;
groupshared float mm_Asub[64][64];
struct tint_array_wrapper_1 { groupshared float mm_Bsub[64][64];
float arr[64];
};
struct tint_array_wrapper {
tint_array_wrapper_1 arr[64];
};
groupshared tint_array_wrapper mm_Asub;
groupshared tint_array_wrapper mm_Bsub;
struct tint_symbol_1 { struct tint_symbol_1 {
uint3 local_id : SV_GroupThreadID; uint3 local_id : SV_GroupThreadID;
uint local_invocation_index : SV_GroupIndex; uint local_invocation_index : SV_GroupIndex;
uint3 global_id : SV_DispatchThreadID; uint3 global_id : SV_DispatchThreadID;
}; };
struct tint_array_wrapper_2 {
float arr[16];
};
struct tint_array_wrapper_3 {
float arr[4];
};
[numthreads(16, 16, 1)] [numthreads(16, 16, 1)]
void main(tint_symbol_1 tint_symbol) { void main(tint_symbol_1 tint_symbol) {
@ -83,9 +69,9 @@ void main(tint_symbol_1 tint_symbol) {
const uint3 global_id = tint_symbol.global_id; const uint3 global_id = tint_symbol.global_id;
const uint local_invocation_index = tint_symbol.local_invocation_index; const uint local_invocation_index = tint_symbol.local_invocation_index;
if ((local_invocation_index == 0u)) { if ((local_invocation_index == 0u)) {
const tint_array_wrapper tint_symbol_5 = {(tint_array_wrapper_1[64])0}; const float tint_symbol_5[64][64] = (float[64][64])0;
mm_Asub = tint_symbol_5; mm_Asub = tint_symbol_5;
const tint_array_wrapper tint_symbol_6 = {(tint_array_wrapper_1[64])0}; const float tint_symbol_6[64][64] = (float[64][64])0;
mm_Bsub = tint_symbol_6; mm_Bsub = tint_symbol_6;
} }
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
@ -95,13 +81,13 @@ void main(tint_symbol_1 tint_symbol) {
const uint globalCol = (global_id.x * ColPerThread); const uint globalCol = (global_id.x * ColPerThread);
const uint scalar_offset_9 = (4u) / 4; const uint scalar_offset_9 = (4u) / 4;
const uint numTiles = (((uniforms[scalar_offset_9 / 4][scalar_offset_9 % 4] - 1u) / TileInner) + 1u); const uint numTiles = (((uniforms[scalar_offset_9 / 4][scalar_offset_9 % 4] - 1u) / TileInner) + 1u);
tint_array_wrapper_2 acc = (tint_array_wrapper_2)0; float acc[16] = (float[16])0;
float ACached = 0.0f; float ACached = 0.0f;
tint_array_wrapper_3 BCached = (tint_array_wrapper_3)0; float BCached[4] = (float[4])0;
{ {
uint index = 0u; uint index = 0u;
for(; !(!((index < (RowPerThread * ColPerThread)))); index = (index + 1u)) { for(; !(!((index < (RowPerThread * ColPerThread)))); index = (index + 1u)) {
acc.arr[index] = 0.0f; acc[index] = 0.0f;
} }
} }
const uint ColPerThreadA = (TileInner / 16u); const uint ColPerThreadA = (TileInner / 16u);
@ -119,7 +105,7 @@ void main(tint_symbol_1 tint_symbol) {
for(; !(!((innerCol < ColPerThreadA))); innerCol = (innerCol + 1u)) { for(; !(!((innerCol < ColPerThreadA))); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRow + innerRow); const uint inputRow = (tileRow + innerRow);
const uint inputCol = (tileColA + innerCol); const uint inputCol = (tileColA + innerCol);
mm_Asub.arr[inputRow].arr[inputCol] = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol)); mm_Asub[inputRow][inputCol] = mm_readA((globalRow + innerRow), ((t * TileInner) + inputCol));
} }
} }
} }
@ -132,7 +118,7 @@ void main(tint_symbol_1 tint_symbol) {
for(; !(!((innerCol < ColPerThread))); innerCol = (innerCol + 1u)) { for(; !(!((innerCol < ColPerThread))); innerCol = (innerCol + 1u)) {
const uint inputRow = (tileRowB + innerRow); const uint inputRow = (tileRowB + innerRow);
const uint inputCol = (tileCol + innerCol); const uint inputCol = (tileCol + innerCol);
mm_Bsub.arr[innerCol].arr[inputCol] = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol)); mm_Bsub[innerCol][inputCol] = mm_readB(((t * TileInner) + inputRow), (globalCol + innerCol));
} }
} }
} }
@ -144,18 +130,18 @@ void main(tint_symbol_1 tint_symbol) {
{ {
uint inner = 0u; uint inner = 0u;
for(; !(!((inner < ColPerThread))); inner = (inner + 1u)) { for(; !(!((inner < ColPerThread))); inner = (inner + 1u)) {
BCached.arr[inner] = mm_Bsub.arr[k].arr[(tileCol + inner)]; BCached[inner] = mm_Bsub[k][(tileCol + inner)];
} }
} }
{ {
uint innerRow = 0u; uint innerRow = 0u;
for(; !(!((innerRow < RowPerThread))); innerRow = (innerRow + 1u)) { for(; !(!((innerRow < RowPerThread))); innerRow = (innerRow + 1u)) {
ACached = mm_Asub.arr[(tileRow + innerRow)].arr[k]; ACached = mm_Asub[(tileRow + innerRow)][k];
{ {
uint innerCol = 0u; uint innerCol = 0u;
for(; !(!((innerCol < ColPerThread))); innerCol = (innerCol + 1u)) { for(; !(!((innerCol < ColPerThread))); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol); const uint index = ((innerRow * ColPerThread) + innerCol);
acc.arr[index] = (acc.arr[index] + (ACached * BCached.arr[innerCol])); acc[index] = (acc[index] + (ACached * BCached[innerCol]));
} }
} }
} }
@ -172,7 +158,7 @@ void main(tint_symbol_1 tint_symbol) {
uint innerCol = 0u; uint innerCol = 0u;
for(; !(!((innerCol < ColPerThread))); innerCol = (innerCol + 1u)) { for(; !(!((innerCol < ColPerThread))); innerCol = (innerCol + 1u)) {
const uint index = ((innerRow * ColPerThread) + innerCol); const uint index = ((innerRow * ColPerThread) + innerCol);
mm_write((globalRow + innerRow), (globalCol + innerCol), acc.arr[index]); mm_write((globalRow + innerRow), (globalCol + innerCol), acc[index]);
} }
} }
} }

View File

@ -7,24 +7,8 @@ static int dimBOuter_1 = 0;
RWByteAddressBuffer x_54 : register(u0, space0); RWByteAddressBuffer x_54 : register(u0, space0);
static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u); static uint3 gl_LocalInvocationID = uint3(0u, 0u, 0u);
static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u); static uint3 gl_GlobalInvocationID = uint3(0u, 0u, 0u);
groupshared float mm_Asub[64][64];
struct tint_array_wrapper_1 { groupshared float mm_Bsub[64][1];
float arr[64];
};
struct tint_array_wrapper {
tint_array_wrapper_1 arr[64];
};
groupshared tint_array_wrapper mm_Asub;
struct tint_array_wrapper_3 {
float arr[1];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[64];
};
groupshared tint_array_wrapper_2 mm_Bsub;
ByteAddressBuffer x_165 : register(t1, space0); ByteAddressBuffer x_165 : register(t1, space0);
static int batch = 0; static int batch = 0;
ByteAddressBuffer x_185 : register(t2, space0); ByteAddressBuffer x_185 : register(t2, space0);
@ -161,10 +145,6 @@ void mm_write_i1_i1_f1_(inout int row_2, inout int col_2, inout float value_2) {
return; return;
} }
struct tint_array_wrapper_4 {
tint_array_wrapper_3 arr[1];
};
void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimBOuter) { void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimBOuter) {
int tileRow = 0; int tileRow = 0;
int tileCol = 0; int tileCol = 0;
@ -173,7 +153,7 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
int numTiles = 0; int numTiles = 0;
int innerRow = 0; int innerRow = 0;
int innerCol = 0; int innerCol = 0;
tint_array_wrapper_4 acc = (tint_array_wrapper_4)0; float acc[1][1] = (float[1][1])0;
int tileColA = 0; int tileColA = 0;
int tileRowB = 0; int tileRowB = 0;
int t = 0; int t = 0;
@ -191,7 +171,7 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
int param_6 = 0; int param_6 = 0;
int k = 0; int k = 0;
int inner = 0; int inner = 0;
tint_array_wrapper_3 BCached = (tint_array_wrapper_3)0; float BCached[1] = (float[1])0;
int innerRow_3 = 0; int innerRow_3 = 0;
float ACached = 0.0f; float ACached = 0.0f;
int innerCol_3 = 0; int innerCol_3 = 0;
@ -214,7 +194,7 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
for(; (innerRow < 1); innerRow = (innerRow + 1)) { for(; (innerRow < 1); innerRow = (innerRow + 1)) {
innerCol = 0; innerCol = 0;
for(; (innerCol < 1); innerCol = (innerCol + 1)) { for(; (innerCol < 1); innerCol = (innerCol + 1)) {
acc.arr[innerRow].arr[innerCol] = 0.0f; acc[innerRow][innerCol] = 0.0f;
} }
} }
const uint x_187 = gl_LocalInvocationID.x; const uint x_187 = gl_LocalInvocationID.x;
@ -236,7 +216,7 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
param_3 = (globalRow + innerRow_1); param_3 = (globalRow + innerRow_1);
param_4 = ((x_238 * 64) + x_240); param_4 = ((x_238 * 64) + x_240);
const float x_244 = mm_readA_i1_i1_(param_3, param_4); const float x_244 = mm_readA_i1_i1_(param_3, param_4);
mm_Asub.arr[x_233].arr[x_234] = x_244; mm_Asub[x_233][x_234] = x_244;
} }
} }
innerRow_2 = 0; innerRow_2 = 0;
@ -252,7 +232,7 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
param_5 = ((t * 64) + inputRow_1); param_5 = ((t * 64) + inputRow_1);
param_6 = (x_284 + x_285); param_6 = (x_284 + x_285);
const float x_289 = mm_readB_i1_i1_(param_5, param_6); const float x_289 = mm_readB_i1_i1_(param_5, param_6);
mm_Bsub.arr[x_278].arr[x_279] = x_289; mm_Bsub[x_278][x_279] = x_289;
} }
} }
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
@ -261,21 +241,21 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
inner = 0; inner = 0;
for(; (inner < 1); inner = (inner + 1)) { for(; (inner < 1); inner = (inner + 1)) {
const int x_314 = inner; const int x_314 = inner;
const float x_320 = mm_Bsub.arr[k].arr[(tileCol + inner)]; const float x_320 = mm_Bsub[k][(tileCol + inner)];
BCached.arr[x_314] = x_320; BCached[x_314] = x_320;
} }
innerRow_3 = 0; innerRow_3 = 0;
for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) { for(; (innerRow_3 < 1); innerRow_3 = (innerRow_3 + 1)) {
const float x_338 = mm_Asub.arr[(tileRow + innerRow_3)].arr[k]; const float x_338 = mm_Asub[(tileRow + innerRow_3)][k];
ACached = x_338; ACached = x_338;
innerCol_3 = 0; innerCol_3 = 0;
for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) { for(; (innerCol_3 < 1); innerCol_3 = (innerCol_3 + 1)) {
const int x_347 = innerRow_3; const int x_347 = innerRow_3;
const int x_348 = innerCol_3; const int x_348 = innerCol_3;
const float x_349 = ACached; const float x_349 = ACached;
const float x_352 = BCached.arr[innerCol_3]; const float x_352 = BCached[innerCol_3];
const float x_355 = acc.arr[x_347].arr[x_348]; const float x_355 = acc[x_347][x_348];
acc.arr[x_347].arr[x_348] = (x_355 + (x_349 * x_352)); acc[x_347][x_348] = (x_355 + (x_349 * x_352));
} }
} }
} }
@ -310,7 +290,7 @@ void mm_matMul_i1_i1_i1_(inout int dimAOuter, inout int dimInner, inout int dimB
const int x_404 = innerCol_4; const int x_404 = innerCol_4;
param_7 = (globalRow + innerRow_4); param_7 = (globalRow + innerRow_4);
param_8 = (x_400 + x_401); param_8 = (x_400 + x_401);
const float x_409 = acc.arr[x_403].arr[x_404]; const float x_409 = acc[x_403][x_404];
param_9 = x_409; param_9 = x_409;
mm_write_i1_i1_f1_(param_7, param_8, param_9); mm_write_i1_i1_f1_(param_7, param_8, param_9);
} }
@ -356,9 +336,9 @@ void main(tint_symbol_1 tint_symbol) {
const uint3 gl_GlobalInvocationID_param = tint_symbol.gl_GlobalInvocationID_param; const uint3 gl_GlobalInvocationID_param = tint_symbol.gl_GlobalInvocationID_param;
const uint local_invocation_index = tint_symbol.local_invocation_index; const uint local_invocation_index = tint_symbol.local_invocation_index;
if ((local_invocation_index == 0u)) { if ((local_invocation_index == 0u)) {
const tint_array_wrapper tint_symbol_6 = {(tint_array_wrapper_1[64])0}; const float tint_symbol_6[64][64] = (float[64][64])0;
mm_Asub = tint_symbol_6; mm_Asub = tint_symbol_6;
const tint_array_wrapper_2 tint_symbol_7 = {(tint_array_wrapper_3[64])0}; const float tint_symbol_7[64][1] = (float[64][1])0;
mm_Bsub = tint_symbol_7; mm_Bsub = tint_symbol_7;
} }
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();

View File

@ -3,10 +3,6 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
bool arr[4];
};
void f() { void f() {
tint_array_wrapper v = {(bool[4])0}; bool v[4] = (bool[4])0;
} }

View File

@ -3,10 +3,6 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
float arr[4];
};
void f() { void f() {
tint_array_wrapper v = {(float[4])0}; float v[4] = (float[4])0;
} }

View File

@ -3,10 +3,6 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
int arr[4];
};
void f() { void f() {
tint_array_wrapper v = {(int[4])0}; int v[4] = (int[4])0;
} }

View File

@ -9,10 +9,7 @@ struct S {
float f; float f;
bool b; bool b;
}; };
struct tint_array_wrapper {
S arr[4];
};
void f() { void f() {
tint_array_wrapper v = {(S[4])0}; S v[4] = (S[4])0;
} }

View File

@ -3,10 +3,6 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
uint arr[4];
};
void f() { void f() {
tint_array_wrapper v = {(uint[4])0}; uint v[4] = (uint[4])0;
} }

View File

@ -3,11 +3,8 @@ void unused_entry_point() {
return; return;
} }
struct tint_array_wrapper {
float arr[4];
};
struct S { struct S {
tint_array_wrapper a; float a[4];
}; };
void f() { void f() {

View File

@ -4,14 +4,11 @@ struct tint_symbol_1 {
struct tint_symbol_2 { struct tint_symbol_2 {
float4 value : SV_Position; float4 value : SV_Position;
}; };
struct tint_array_wrapper {
float2 arr[3];
};
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) { tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
const uint VertexIndex = tint_symbol.VertexIndex; const uint VertexIndex = tint_symbol.VertexIndex;
tint_array_wrapper pos = {{float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)}}; float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)};
const tint_symbol_2 tint_symbol_4 = {float4(pos.arr[VertexIndex], 0.0f, 1.0f)}; const tint_symbol_2 tint_symbol_4 = {float4(pos[VertexIndex], 0.0f, 1.0f)};
return tint_symbol_4; return tint_symbol_4;
} }

View File

@ -13,14 +13,8 @@ struct S3 {
S1 h; S1 h;
S2 i; S2 i;
}; };
struct tint_array_wrapper {
int arr[2];
};
struct T { struct T {
tint_array_wrapper a; int a[2];
};
struct tint_array_wrapper_1 {
T arr[2];
}; };
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -51,14 +45,14 @@ void main() {
const S1 tint_symbol_11 = {2, x, (x + 1), nested_nonempty.i.f.d}; const S1 tint_symbol_11 = {2, x, (x + 1), nested_nonempty.i.f.d};
const S2 tint_symbol_12 = {1, tint_symbol_11}; const S2 tint_symbol_12 = {1, tint_symbol_11};
const S1 subexpr_nested_nonempty_with_expr = tint_symbol_12.f; const S1 subexpr_nested_nonempty_with_expr = tint_symbol_12.f;
const tint_array_wrapper_1 aosoa_empty = {(T[2])0}; const T aosoa_empty[2] = (T[2])0;
const tint_array_wrapper tint_symbol_13 = {{1, 2}}; const int tint_symbol_13[2] = {1, 2};
const T tint_symbol_14 = {tint_symbol_13}; const T tint_symbol_14 = {tint_symbol_13};
const tint_array_wrapper tint_symbol_15 = {{3, 4}}; const int tint_symbol_15[2] = {3, 4};
const T tint_symbol_16 = {tint_symbol_15}; const T tint_symbol_16 = {tint_symbol_15};
const tint_array_wrapper_1 aosoa_nonempty = {{tint_symbol_14, tint_symbol_16}}; const T aosoa_nonempty[2] = {tint_symbol_14, tint_symbol_16};
const tint_array_wrapper tint_symbol_17 = {{1, (aosoa_nonempty.arr[0].a.arr[0] + 1)}}; const int tint_symbol_17[2] = {1, (aosoa_nonempty[0].a[0] + 1)};
const T tint_symbol_18 = {tint_symbol_17}; const T tint_symbol_18 = {tint_symbol_17};
const tint_array_wrapper_1 aosoa_nonempty_with_expr = {{tint_symbol_18, aosoa_nonempty.arr[1]}}; const T aosoa_nonempty_with_expr[2] = {tint_symbol_18, aosoa_nonempty[1]};
return; return;
} }

View File

@ -1,9 +1,6 @@
struct S { struct S {
float a; float a;
}; };
struct tint_array_wrapper {
float arr[4];
};
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
@ -23,8 +20,8 @@ void main() {
const float4 v4f32_let = float4(0.0f, 0.0f, 0.0f, 0.0f); const float4 v4f32_let = float4(0.0f, 0.0f, 0.0f, 0.0f);
float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
const float3x4 m3x4_let = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); const float3x4 m3x4_let = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
tint_array_wrapper arr_var = {(float[4])0}; float arr_var[4] = (float[4])0;
const tint_array_wrapper arr_let = {(float[4])0}; const float arr_let[4] = (float[4])0;
S struct_var = (S)0; S struct_var = (S)0;
const S struct_let = (S)0; const S struct_let = (S)0;
return; return;

View File

@ -10,12 +10,7 @@ static const int2 v2i32_let = int2(0, 0);
static const uint3 v3u32_let = uint3(0u, 0u, 0u); static const uint3 v3u32_let = uint3(0u, 0u, 0u);
static const float4 v4f32_let = float4(0.0f, 0.0f, 0.0f, 0.0f); static const float4 v4f32_let = float4(0.0f, 0.0f, 0.0f, 0.0f);
static const float3x4 m3x4_let = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static const float3x4 m3x4_let = float3x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
static const float arr_let[4] = (float[4])0;
struct tint_array_wrapper {
float arr[4];
};
static const tint_array_wrapper arr_let = {(float[4])0};
static const S struct_let = (S)0; static const S struct_let = (S)0;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -10,12 +10,7 @@ static int2 v2i32_var = int2(0, 0);
static uint3 v3u32_var = uint3(0u, 0u, 0u); static uint3 v3u32_var = uint3(0u, 0u, 0u);
static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
static float arr_var[4] = (float[4])0;
struct tint_array_wrapper {
float arr[4];
};
static tint_array_wrapper arr_var = (tint_array_wrapper)0;
static S struct_var = (S)0; static S struct_var = (S)0;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -28,7 +23,7 @@ void main() {
v3u32_var = uint3(0u, 0u, 0u); v3u32_var = uint3(0u, 0u, 0u);
v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f);
m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
const tint_array_wrapper tint_symbol = {(float[4])0}; const float tint_symbol[4] = (float[4])0;
arr_var = tint_symbol; arr_var = tint_symbol;
const S tint_symbol_1 = (S)0; const S tint_symbol_1 = (S)0;
struct_var = tint_symbol_1; struct_var = tint_symbol_1;

View File

@ -10,12 +10,7 @@ static int2 v2i32_var = int2(0, 0);
static uint3 v3u32_var = uint3(0u, 0u, 0u); static uint3 v3u32_var = uint3(0u, 0u, 0u);
static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); static float4 v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); static float2x3 m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
static float arr_var[4] = (float[4])0;
struct tint_array_wrapper {
float arr[4];
};
static tint_array_wrapper arr_var = {(float[4])0};
static S struct_var = (S)0; static S struct_var = (S)0;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -28,7 +23,7 @@ void main() {
v3u32_var = uint3(0u, 0u, 0u); v3u32_var = uint3(0u, 0u, 0u);
v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f); v4f32_var = float4(0.0f, 0.0f, 0.0f, 0.0f);
m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); m2x3_var = float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
const tint_array_wrapper tint_symbol = {(float[4])0}; const float tint_symbol[4] = (float[4])0;
arr_var = tint_symbol; arr_var = tint_symbol;
const S tint_symbol_1 = (S)0; const S tint_symbol_1 = (S)0;
struct_var = tint_symbol_1; struct_var = tint_symbol_1;

View File

@ -1,11 +1,8 @@
struct S { struct S {
float a; float a;
}; };
struct tint_array_wrapper {
float arr[4];
};
void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, int2 param_v2i32, uint3 param_v3u32, float4 param_v4f32, float2x3 param_m2x3, tint_array_wrapper param_arr, S param_struct, inout float param_ptr_f32, inout float4 param_ptr_vec, inout tint_array_wrapper param_ptr_arr) { void foo(bool param_bool, int param_i32, uint param_u32, float param_f32, int2 param_v2i32, uint3 param_v3u32, float4 param_v4f32, float2x3 param_m2x3, float param_arr[4], S param_struct, inout float param_ptr_f32, inout float4 param_ptr_vec, inout float param_ptr_arr[4]) {
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -34,12 +34,9 @@ float2x3 ret_m2x3() {
return float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); return float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
} }
struct tint_array_wrapper { typedef float ret_arr_ret[4];
float arr[4]; ret_arr_ret ret_arr() {
}; const float tint_symbol[4] = (float[4])0;
tint_array_wrapper ret_arr() {
const tint_array_wrapper tint_symbol = {(float[4])0};
return tint_symbol; return tint_symbol;
} }

View File

@ -1,9 +1,6 @@
struct S_inner { struct S_inner {
float a; float a;
}; };
struct tint_array_wrapper {
float arr[4];
};
struct S { struct S {
bool member_bool; bool member_bool;
int member_i32; int member_i32;
@ -13,7 +10,7 @@ struct S {
uint3 member_v3u32; uint3 member_v3u32;
float4 member_v4f32; float4 member_v4f32;
float2x3 member_m2x3; float2x3 member_m2x3;
tint_array_wrapper member_arr; float member_arr[4];
S_inner member_struct; S_inner member_struct;
}; };

View File

@ -1,9 +1,6 @@
struct MyStruct { struct MyStruct {
float f1; float f1;
}; };
struct tint_array_wrapper {
float arr[10];
};
int ret_i32() { int ret_i32() {
return 1; return 1;
@ -22,8 +19,9 @@ MyStruct ret_MyStruct() {
return tint_symbol_1; return tint_symbol_1;
} }
tint_array_wrapper ret_MyArray() { typedef float ret_MyArray_ret[10];
const tint_array_wrapper tint_symbol_2 = {(float[10])0}; ret_MyArray_ret ret_MyArray() {
const float tint_symbol_2[10] = (float[10])0;
return tint_symbol_2; return tint_symbol_2;
} }
@ -36,13 +34,13 @@ void let_decls() {
const float3 v6 = float3(1.0f, 1.0f, 1.0f); const float3 v6 = float3(1.0f, 1.0f, 1.0f);
const float3x3 v7 = float3x3(v6, v6, v6); const float3x3 v7 = float3x3(v6, v6, v6);
const MyStruct v8 = {1.0f}; const MyStruct v8 = {1.0f};
const tint_array_wrapper v9 = {(float[10])0}; const float v9[10] = (float[10])0;
const int v10 = ret_i32(); const int v10 = ret_i32();
const uint v11 = ret_u32(); const uint v11 = ret_u32();
const float v12 = ret_f32(); const float v12 = ret_f32();
const MyStruct v13 = ret_MyStruct(); const MyStruct v13 = ret_MyStruct();
const MyStruct v14 = ret_MyStruct(); const MyStruct v14 = ret_MyStruct();
const tint_array_wrapper v15 = ret_MyArray(); const float v15[10] = ret_MyArray();
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,9 +1,6 @@
struct MyStruct { struct MyStruct {
float f1; float f1;
}; };
struct tint_array_wrapper {
float arr[10];
};
int ret_i32() { int ret_i32() {
return 1; return 1;
@ -22,8 +19,9 @@ MyStruct ret_MyStruct() {
return tint_symbol_1; return tint_symbol_1;
} }
tint_array_wrapper ret_MyArray() { typedef float ret_MyArray_ret[10];
const tint_array_wrapper tint_symbol_2 = {(float[10])0}; ret_MyArray_ret ret_MyArray() {
const float tint_symbol_2[10] = (float[10])0;
return tint_symbol_2; return tint_symbol_2;
} }
@ -36,13 +34,13 @@ void var_decls() {
float3 v6 = float3(1.0f, 1.0f, 1.0f); float3 v6 = float3(1.0f, 1.0f, 1.0f);
float3x3 v7 = float3x3(v6, v6, v6); float3x3 v7 = float3x3(v6, v6, v6);
MyStruct v8 = {1.0f}; MyStruct v8 = {1.0f};
tint_array_wrapper v9 = {(float[10])0}; float v9[10] = (float[10])0;
int v10 = ret_i32(); int v10 = ret_i32();
uint v11 = ret_u32(); uint v11 = ret_u32();
float v12 = ret_f32(); float v12 = ret_f32();
MyStruct v13 = ret_MyStruct(); MyStruct v13 = ret_MyStruct();
MyStruct v14 = ret_MyStruct(); MyStruct v14 = ret_MyStruct();
tint_array_wrapper v15 = ret_MyArray(); float v15[10] = ret_MyArray();
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,9 +1,6 @@
struct MyStruct { struct MyStruct {
float f1; float f1;
}; };
struct tint_array_wrapper {
float arr[10];
};
static const int v1 = 1; static const int v1 = 1;
static const uint v2 = 1u; static const uint v2 = 1u;
@ -13,7 +10,7 @@ static const uint3 v5 = uint3(1u, 1u, 1u);
static const float3 v6 = float3(1.0f, 1.0f, 1.0f); static const float3 v6 = float3(1.0f, 1.0f, 1.0f);
static const float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f)); static const float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f));
static const MyStruct v8 = (MyStruct)0; static const MyStruct v8 = (MyStruct)0;
static const tint_array_wrapper v9 = {(float[10])0}; static const float v9[10] = (float[10])0;
struct tint_symbol { struct tint_symbol {
float4 value : SV_Target0; float4 value : SV_Target0;

View File

@ -1,10 +1,6 @@
struct tint_array_wrapper {
int arr[3];
};
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
tint_array_wrapper v = (tint_array_wrapper)0; int v[3] = (int[3])0;
v; v;
return; return;
} }

View File

@ -1,8 +1,4 @@
struct tint_array_wrapper { static int v[3] = (int[3])0;
int arr[3];
};
static tint_array_wrapper v = (tint_array_wrapper)0;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {

View File

@ -1,8 +1,4 @@
struct tint_array_wrapper { groupshared int v[3];
int arr[3];
};
groupshared tint_array_wrapper v;
struct tint_symbol_1 { struct tint_symbol_1 {
uint local_invocation_index : SV_GroupIndex; uint local_invocation_index : SV_GroupIndex;
@ -12,7 +8,7 @@ struct tint_symbol_1 {
void main(tint_symbol_1 tint_symbol) { void main(tint_symbol_1 tint_symbol) {
const uint local_invocation_index = tint_symbol.local_invocation_index; const uint local_invocation_index = tint_symbol.local_invocation_index;
if ((local_invocation_index == 0u)) { if ((local_invocation_index == 0u)) {
const tint_array_wrapper tint_symbol_2 = {(int[3])0}; const int tint_symbol_2[3] = (int[3])0;
v = tint_symbol_2; v = tint_symbol_2;
} }
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();