writer/hlsl: Use the WrapArraysInStructs transform
Fixes issues with using arrays as function return types.
Fixed: tint:848
Change-Id: Iee8af0f2cea9d19e448176446c6599be2bd32316
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54321
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/transform/hlsl.cc b/src/transform/hlsl.cc
index 208054a..e050bb7 100644
--- a/src/transform/hlsl.cc
+++ b/src/transform/hlsl.cc
@@ -25,6 +25,7 @@
#include "src/transform/manager.h"
#include "src/transform/promote_initializers_to_const_var.h"
#include "src/transform/simplify.h"
+#include "src/transform/wrap_arrays_in_structs.h"
namespace tint {
namespace transform {
@@ -50,6 +51,7 @@
manager.Add<CalculateArrayLength>();
manager.Add<ExternalTextureTransform>();
manager.Add<PromoteInitializersToConstVar>();
+ manager.Add<WrapArraysInStructs>();
data.Add<CanonicalizeEntryPointIO::Config>(
CanonicalizeEntryPointIO::BuiltinStyle::kStructMember);
auto out = manager.Run(in, data);
diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc
index d1c636a..6add088 100644
--- a/src/writer/hlsl/generator_impl_function_test.cc
+++ b/src/writer/hlsl/generator_impl_function_test.cc
@@ -763,15 +763,39 @@
Return(),
});
- GeneratorImpl& gen = Build();
-
- gen.increment_indent();
+ GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate(out)) << gen.error();
- EXPECT_EQ(result(), R"( void my_func(float a[5]) {
- return;
- }
-)");
+ EXPECT_THAT(result(), HasSubstr(R"(
+struct tint_array_wrapper {
+ float arr[5];
+};
+
+void my_func(tint_array_wrapper a) {
+ return;
+}
+)"));
+}
+
+TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayReturn) {
+ Func("my_func", {}, ty.array<f32, 5>(),
+ {
+ Return(Construct(ty.array<f32, 5>())),
+ });
+
+ GeneratorImpl& gen = SanitizeAndBuild();
+
+ ASSERT_TRUE(gen.Generate(out)) << gen.error();
+ EXPECT_THAT(result(), HasSubstr(R"(
+struct tint_array_wrapper {
+ float arr[5];
+};
+
+tint_array_wrapper my_func() {
+ const tint_array_wrapper tint_symbol = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
+ return tint_symbol;
+}
+)"));
}
// https://crbug.com/tint/297
diff --git a/src/writer/hlsl/generator_impl_sanitizer_test.cc b/src/writer/hlsl/generator_impl_sanitizer_test.cc
index 95859e0..473b336 100644
--- a/src/writer/hlsl/generator_impl_sanitizer_test.cc
+++ b/src/writer/hlsl/generator_impl_sanitizer_test.cc
@@ -206,9 +206,13 @@
ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto got = result();
- auto* expect = R"(void main() {
- const int tint_symbol[4] = {1, 2, 3, 4};
- int pos = tint_symbol[3];
+ auto* expect = R"(struct tint_array_wrapper {
+ int arr[4];
+};
+
+void main() {
+ const tint_array_wrapper tint_symbol = {{1, 2, 3, 4}};
+ int pos = tint_symbol.arr[3];
return;
}
)";
diff --git a/test/array/assign_to_function_var.wgsl.expected.hlsl b/test/array/assign_to_function_var.wgsl.expected.hlsl
index dde8c7d..0ab89ca 100644
--- a/test/array/assign_to_function_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_function_var.wgsl.expected.hlsl
@@ -1,43 +1,53 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
-struct S {
+struct tint_array_wrapper {
int arr[4];
};
+struct S {
+ tint_array_wrapper arr;
+};
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- const int tint_symbol_3[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
+tint_array_wrapper tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
+ const tint_array_wrapper tint_symbol_3 = {{asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))}};
return tint_symbol_3;
}
-static int src_private[4];
-groupshared int src_workgroup[4];
+static tint_array_wrapper src_private;
+groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
-int[4] ret_arr() {
- const int tint_symbol_4[4] = {0, 0, 0, 0};
+tint_array_wrapper ret_arr() {
+ const tint_array_wrapper tint_symbol_4 = {{0, 0, 0, 0}};
return tint_symbol_4;
}
+
S ret_struct_arr() {
- const S tint_symbol_5 = {{0, 0, 0, 0}};
+ const S tint_symbol_5 = {{{0, 0, 0, 0}}};
return tint_symbol_5;
}
-void foo(int src_param[4]) {
- int src_function[4] = {0, 0, 0, 0};
- int tint_symbol[4] = {0, 0, 0, 0};
- const int tint_symbol_6[4] = {1, 2, 3, 3};
+
+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 = {{0, 0, 0, 0}};
+ tint_array_wrapper tint_symbol = {{0, 0, 0, 0}};
+ const tint_array_wrapper tint_symbol_6 = {{1, 2, 3, 3}};
tint_symbol = tint_symbol_6;
tint_symbol = src_param;
tint_symbol = ret_arr();
- const int src_let[4] = {0, 0, 0, 0};
+ const tint_array_wrapper src_let = {{0, 0, 0, 0}};
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
@@ -45,17 +55,7 @@
tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u);
- int dst_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
- int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
+ tint_array_wrapper_1 dst_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
+ tint_array_wrapper_1 src_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
dst_nested = src_nested;
}
-
-tint_bTL3Zd:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- ~~~ ^
- [4]
-tint_bTL3Zd:20:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] ret_arr() {
- ~~~ ^
- [4]
-
diff --git a/test/array/assign_to_private_var.wgsl.expected.hlsl b/test/array/assign_to_private_var.wgsl.expected.hlsl
index fc6abcf..a934fd4 100644
--- a/test/array/assign_to_private_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_private_var.wgsl.expected.hlsl
@@ -1,44 +1,55 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
-struct S {
+struct tint_array_wrapper {
int arr[4];
};
+struct S {
+ tint_array_wrapper arr;
+};
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- const int tint_symbol_3[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
+tint_array_wrapper tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
+ const tint_array_wrapper tint_symbol_3 = {{asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))}};
return tint_symbol_3;
}
-static int src_private[4];
-groupshared int src_workgroup[4];
+static tint_array_wrapper src_private;
+groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
-static int tint_symbol[4];
-static int dst_nested[4][3][2];
+static tint_array_wrapper tint_symbol;
-int[4] ret_arr() {
- const int tint_symbol_4[4] = {0, 0, 0, 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 ret_arr() {
+ const tint_array_wrapper tint_symbol_4 = {{0, 0, 0, 0}};
return tint_symbol_4;
}
+
S ret_struct_arr() {
- const S tint_symbol_5 = {{0, 0, 0, 0}};
+ const S tint_symbol_5 = {{{0, 0, 0, 0}}};
return tint_symbol_5;
}
-void foo(int src_param[4]) {
- int src_function[4] = {0, 0, 0, 0};
- const int tint_symbol_6[4] = {1, 2, 3, 3};
+
+void foo(tint_array_wrapper src_param) {
+ tint_array_wrapper src_function = {{0, 0, 0, 0}};
+ const tint_array_wrapper tint_symbol_6 = {{1, 2, 3, 3}};
tint_symbol = tint_symbol_6;
tint_symbol = src_param;
tint_symbol = ret_arr();
- const int src_let[4] = {0, 0, 0, 0};
+ const tint_array_wrapper src_let = {{0, 0, 0, 0}};
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
@@ -46,16 +57,6 @@
tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u);
- int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
+ tint_array_wrapper_1 src_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
dst_nested = src_nested;
}
-
-tint_Sca05u:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- ~~~ ^
- [4]
-tint_Sca05u:22:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] ret_arr() {
- ~~~ ^
- [4]
-
diff --git a/test/array/assign_to_storage_var.wgsl.expected.hlsl b/test/array/assign_to_storage_var.wgsl.expected.hlsl
index 826856e..d7fadb0 100644
--- a/test/array/assign_to_storage_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_storage_var.wgsl.expected.hlsl
@@ -1,66 +1,79 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
-struct S {
+struct tint_array_wrapper {
int arr[4];
};
+struct S {
+ tint_array_wrapper arr;
+};
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- const int tint_symbol_9[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
+tint_array_wrapper tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
+ const tint_array_wrapper tint_symbol_9 = {{asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))}};
return tint_symbol_9;
}
-void tint_symbol_4(RWByteAddressBuffer buffer, uint offset, int value[4]) {
- buffer.Store((offset + 0u), asuint(value[0u]));
- buffer.Store((offset + 16u), asuint(value[1u]));
- buffer.Store((offset + 32u), asuint(value[2u]));
- buffer.Store((offset + 48u), asuint(value[3u]));
+
+void tint_symbol_4(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper value) {
+ buffer.Store((offset + 0u), asuint(value.arr[0u]));
+ buffer.Store((offset + 16u), asuint(value.arr[1u]));
+ buffer.Store((offset + 32u), asuint(value.arr[2u]));
+ buffer.Store((offset + 48u), asuint(value.arr[3u]));
}
-void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, int value[2]) {
- buffer.Store((offset + 0u), asuint(value[0u]));
- buffer.Store((offset + 4u), asuint(value[1u]));
-}
-void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
- tint_symbol_6(buffer, (offset + 0u), value[0u]);
- tint_symbol_6(buffer, (offset + 8u), value[1u]);
- tint_symbol_6(buffer, (offset + 16u), value[2u]);
-}
-void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
- tint_symbol_7(buffer, (offset + 0u), value[0u]);
- tint_symbol_7(buffer, (offset + 24u), value[1u]);
- tint_symbol_7(buffer, (offset + 48u), value[2u]);
- tint_symbol_7(buffer, (offset + 72u), value[3u]);
+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_6(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]));
}
-static int src_private[4];
-groupshared int src_workgroup[4];
+void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_2 value) {
+ tint_symbol_6(buffer, (offset + 0u), value.arr[0u]);
+ tint_symbol_6(buffer, (offset + 8u), value.arr[1u]);
+ tint_symbol_6(buffer, (offset + 16u), value.arr[2u]);
+}
+
+void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_1 value) {
+ tint_symbol_7(buffer, (offset + 0u), value.arr[0u]);
+ tint_symbol_7(buffer, (offset + 24u), value.arr[1u]);
+ tint_symbol_7(buffer, (offset + 48u), value.arr[2u]);
+ tint_symbol_7(buffer, (offset + 72u), value.arr[3u]);
+}
+
+static tint_array_wrapper src_private;
+groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
RWByteAddressBuffer tint_symbol : register(u2, space0);
RWByteAddressBuffer dst_nested : register(u3, space0);
-int[4] ret_arr() {
- const int tint_symbol_10[4] = {0, 0, 0, 0};
+tint_array_wrapper ret_arr() {
+ const tint_array_wrapper tint_symbol_10 = {{0, 0, 0, 0}};
return tint_symbol_10;
}
+
S ret_struct_arr() {
- const S tint_symbol_11 = {{0, 0, 0, 0}};
+ const S tint_symbol_11 = {{{0, 0, 0, 0}}};
return tint_symbol_11;
}
-void foo(int src_param[4]) {
- int src_function[4] = {0, 0, 0, 0};
- const int tint_symbol_12[4] = {1, 2, 3, 3};
+
+void foo(tint_array_wrapper src_param) {
+ tint_array_wrapper src_function = {{0, 0, 0, 0}};
+ const tint_array_wrapper tint_symbol_12 = {{1, 2, 3, 3}};
tint_symbol_4(tint_symbol, 0u, tint_symbol_12);
tint_symbol_4(tint_symbol, 0u, src_param);
tint_symbol_4(tint_symbol, 0u, ret_arr());
- const int src_let[4] = {0, 0, 0, 0};
+ const tint_array_wrapper src_let = {{0, 0, 0, 0}};
tint_symbol_4(tint_symbol, 0u, src_let);
tint_symbol_4(tint_symbol, 0u, src_function);
tint_symbol_4(tint_symbol, 0u, src_private);
@@ -68,16 +81,6 @@
tint_symbol_4(tint_symbol, 0u, ret_struct_arr().arr);
tint_symbol_4(tint_symbol, 0u, src_uniform.arr);
tint_symbol_4(tint_symbol, 0u, tint_symbol_2(src_storage, 0u));
- int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
+ tint_array_wrapper_1 src_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
tint_symbol_8(dst_nested, 0u, src_nested);
}
-
-tint_4gsbi1:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- ~~~ ^
- [4]
-tint_4gsbi1:44:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] ret_arr() {
- ~~~ ^
- [4]
-
diff --git a/test/array/assign_to_subexpr.wgsl.expected.hlsl b/test/array/assign_to_subexpr.wgsl.expected.hlsl
index ff919f6..1c1d5f5 100644
--- a/test/array/assign_to_subexpr.wgsl.expected.hlsl
+++ b/test/array/assign_to_subexpr.wgsl.expected.hlsl
@@ -3,18 +3,24 @@
return;
}
-struct S {
+struct tint_array_wrapper {
int arr[4];
};
+struct S {
+ tint_array_wrapper arr;
+};
+struct tint_array_wrapper_1 {
+ tint_array_wrapper arr[2];
+};
void foo() {
- const int src[4] = {0, 0, 0, 0};
- int tint_symbol[4] = {0, 0, 0, 0};
- S dst_struct = {{0, 0, 0, 0}};
- int dst_array[2][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}};
+ const tint_array_wrapper src = {{0, 0, 0, 0}};
+ tint_array_wrapper tint_symbol = {{0, 0, 0, 0}};
+ S dst_struct = {{{0, 0, 0, 0}}};
+ tint_array_wrapper_1 dst_array = {{{{0, 0, 0, 0}}, {{0, 0, 0, 0}}}};
dst_struct.arr = src;
- dst_array[1] = src;
+ dst_array.arr[1] = src;
tint_symbol = src;
dst_struct.arr = src;
- dst_array[0] = src;
+ dst_array.arr[0] = src;
}
diff --git a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
index 9f61247..0a4904b 100644
--- a/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
+++ b/test/array/assign_to_workgroup_var.wgsl.expected.hlsl
@@ -1,44 +1,55 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
-struct S {
+struct tint_array_wrapper {
int arr[4];
};
+struct S {
+ tint_array_wrapper arr;
+};
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- const int tint_symbol_3[4] = {asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))};
+tint_array_wrapper tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
+ const tint_array_wrapper tint_symbol_3 = {{asint(buffer.Load((offset + 0u))), asint(buffer.Load((offset + 16u))), asint(buffer.Load((offset + 32u))), asint(buffer.Load((offset + 48u)))}};
return tint_symbol_3;
}
-static int src_private[4];
-groupshared int src_workgroup[4];
+static tint_array_wrapper src_private;
+groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0);
-groupshared int tint_symbol[4];
-groupshared int dst_nested[4][3][2];
+groupshared tint_array_wrapper tint_symbol;
-int[4] ret_arr() {
- const int tint_symbol_4[4] = {0, 0, 0, 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];
+};
+
+groupshared tint_array_wrapper_1 dst_nested;
+
+tint_array_wrapper ret_arr() {
+ const tint_array_wrapper tint_symbol_4 = {{0, 0, 0, 0}};
return tint_symbol_4;
}
+
S ret_struct_arr() {
- const S tint_symbol_5 = {{0, 0, 0, 0}};
+ const S tint_symbol_5 = {{{0, 0, 0, 0}}};
return tint_symbol_5;
}
-void foo(int src_param[4]) {
- int src_function[4] = {0, 0, 0, 0};
- const int tint_symbol_6[4] = {1, 2, 3, 3};
+
+void foo(tint_array_wrapper src_param) {
+ tint_array_wrapper src_function = {{0, 0, 0, 0}};
+ const tint_array_wrapper tint_symbol_6 = {{1, 2, 3, 3}};
tint_symbol = tint_symbol_6;
tint_symbol = src_param;
tint_symbol = ret_arr();
- const int src_let[4] = {0, 0, 0, 0};
+ const tint_array_wrapper src_let = {{0, 0, 0, 0}};
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
@@ -46,16 +57,6 @@
tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u);
- int src_nested[4][3][2] = {{{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}, {{0, 0}, {0, 0}, {0, 0}}};
+ tint_array_wrapper_1 src_nested = {{{{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}, {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}}};
dst_nested = src_nested;
}
-
-tint_atjMoG:10:62: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
- ~~~ ^
- [4]
-tint_atjMoG:22:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
-int[4] ret_arr() {
- ~~~ ^
- [4]
-
diff --git a/test/array/function_parameter.wgsl.expected.hlsl b/test/array/function_parameter.wgsl.expected.hlsl
index 3ad8519..7c3bbf9 100644
--- a/test/array/function_parameter.wgsl.expected.hlsl
+++ b/test/array/function_parameter.wgsl.expected.hlsl
@@ -1,20 +1,32 @@
-float f1(float a[4]) {
- return a[3];
+struct tint_array_wrapper {
+ float arr[4];
+};
+
+float f1(tint_array_wrapper a) {
+ return a.arr[3];
}
-float f2(float a[3][4]) {
- return a[2][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 f3(float a[2][3][4]) {
- return a[1][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];
}
[numthreads(1, 1, 1)]
void main() {
- const float a1[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- const float a2[3][4] = {{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 float a3[2][3][4] = {{{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}}, {{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 tint_array_wrapper a1 = {{0.0f, 0.0f, 0.0f, 0.0f}};
+ const tint_array_wrapper_1 a2 = {{{{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 tint_array_wrapper_2 a3 = {{{{{{0.0f, 0.0f, 0.0f, 0.0f}}, {{0.0f, 0.0f, 0.0f, 0.0f}}, {{0.0f, 0.0f, 0.0f, 0.0f}}}}, {{{{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 float v1 = f1(a1);
const float v2 = f2(a2);
const float v3 = f3(a3);
diff --git a/test/array/function_return_type.wgsl.expected.hlsl b/test/array/function_return_type.wgsl.expected.hlsl
index 779a2f3..7109b7f 100644
--- a/test/array/function_return_type.wgsl.expected.hlsl
+++ b/test/array/function_return_type.wgsl.expected.hlsl
@@ -1,38 +1,34 @@
-SKIP: FAILED
+struct tint_array_wrapper {
+ float arr[4];
+};
-
-
-Validation Failure:
-float[4] f1() {
- const float tint_symbol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+tint_array_wrapper f1() {
+ const tint_array_wrapper tint_symbol = {{0.0f, 0.0f, 0.0f, 0.0f}};
return tint_symbol;
}
-float[3][4] f2() {
- const float tint_symbol_1[3][4] = {f1(), f1(), f1()};
+
+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()}};
return tint_symbol_1;
}
-float[2][3][4] f3() {
- const float tint_symbol_2[2][3][4] = {f2(), f2()};
+
+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()}};
return tint_symbol_2;
}
+
[numthreads(1, 1, 1)]
void main() {
- const float a1[4] = f1();
- const float a2[3][4] = f2();
- const float a3[2][3][4] = f3();
+ const tint_array_wrapper a1 = f1();
+ const tint_array_wrapper_1 a2 = f2();
+ const tint_array_wrapper_2 a3 = f3();
return;
}
-
-tint_gQgfKR:1:14: error: brackets are not allowed here; to declare an array, place the brackets after the name
-float[4] f1() {
- ~~~ ^
- [4]
-tint_gQgfKR:5:17: error: brackets are not allowed here; to declare an array, place the brackets after the name
-float[3][4] f2() {
- ~~~~~~ ^
- [3][4]
-tint_gQgfKR:9:20: error: brackets are not allowed here; to declare an array, place the brackets after the name
-float[2][3][4] f3() {
- ~~~~~~~~~ ^
- [2][3][4]
-
diff --git a/test/array/type_constructor.wgsl.expected.hlsl b/test/array/type_constructor.wgsl.expected.hlsl
index 3a9ad86..0c2040a 100644
--- a/test/array/type_constructor.wgsl.expected.hlsl
+++ b/test/array/type_constructor.wgsl.expected.hlsl
@@ -1,37 +1,50 @@
+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 int empty[4] = {0, 0, 0, 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] = {{{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 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] = {0, 0, 0, 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] = {{0, 0, 0, 0}, {0, 0, 0, 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];
+ const tint_array_wrapper empty = {{0, 0, 0, 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 = {{{{{{0, 0, 0, 0}}, {{0, 0, 0, 0}}, {{0, 0, 0, 0}}}}, {{{{0, 0, 0, 0}}, {{0, 0, 0, 0}}, {{0, 0, 0, 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 = {{0, 0, 0, 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 = {{{{0, 0, 0, 0}}, {{0, 0, 0, 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];
return;
}
diff --git a/test/bug/tint/403.wgsl.expected.hlsl b/test/bug/tint/403.wgsl.expected.hlsl
index 9a17baa..7346f53 100644
--- a/test/bug/tint/403.wgsl.expected.hlsl
+++ b/test/bug/tint/403.wgsl.expected.hlsl
@@ -19,16 +19,19 @@
struct tint_symbol_2 {
float4 value : SV_Position;
};
+struct tint_array_wrapper {
+ float2 arr[3];
+};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const int gl_VertexIndex = tint_symbol.gl_VertexIndex;
- float2 indexable[3] = {float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)};
+ tint_array_wrapper indexable = {{float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f)}};
const float2x2 x_23 = x_20.transform1;
const float2x2 x_28 = x_26.transform2;
const int x_46 = gl_VertexIndex;
- const float2 tint_symbol_3[3] = {float2(-1.0f, 1.0f), float2(1.0f, 1.0f), float2(-1.0f, -1.0f)};
+ const tint_array_wrapper tint_symbol_3 = {{float2(-1.0f, 1.0f), float2(1.0f, 1.0f), float2(-1.0f, -1.0f)}};
indexable = tint_symbol_3;
- const float2 x_51 = indexable[x_46];
+ const float2 x_51 = indexable.arr[x_46];
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_4 = {float4(x_52.x, x_52.y, 0.0f, 1.0f)};
return tint_symbol_4;
diff --git a/test/bug/tint/749.spvasm.expected.hlsl b/test/bug/tint/749.spvasm.expected.hlsl
index a31fd28..3697b88 100644
--- a/test/bug/tint/749.spvasm.expected.hlsl
+++ b/test/bug/tint/749.spvasm.expected.hlsl
@@ -1,6 +1,6 @@
SKIP: FAILED
-../src/writer/hlsl/generator_impl.cc:1726 internal compiler error: unhandled storage class in
+../src/writer/hlsl/generator_impl.cc:1547 internal compiler error: unhandled storage class in
********************************************************************
* The tint shader compiler has encountered an unexpected error. *
* *
diff --git a/test/bug/tint/782.wgsl.expected.hlsl b/test/bug/tint/782.wgsl.expected.hlsl
index efa1c02..be8d812 100644
--- a/test/bug/tint/782.wgsl.expected.hlsl
+++ b/test/bug/tint/782.wgsl.expected.hlsl
@@ -3,8 +3,12 @@
return;
}
+struct tint_array_wrapper {
+ int arr[2];
+};
+
void foo() {
- int tint_symbol[2] = {0, 0};
- int implict[2] = {0, 0};
+ tint_array_wrapper tint_symbol = {{0, 0}};
+ tint_array_wrapper implict = {{0, 0}};
implict = tint_symbol;
}
diff --git a/test/bug/tint/824.wgsl.expected.hlsl b/test/bug/tint/824.wgsl.expected.hlsl
index f2d0421..9351b48 100644
--- a/test/bug/tint/824.wgsl.expected.hlsl
+++ b/test/bug/tint/824.wgsl.expected.hlsl
@@ -10,16 +10,22 @@
float4 color : TEXCOORD0;
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) {
const uint VertexIndex = tint_symbol.VertexIndex;
const uint InstanceIndex = tint_symbol.InstanceIndex;
- const 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[InstanceIndex].x;
+ const tint_array_wrapper zv = {{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;
Output output = {float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)};
output.Position = float4(0.5f, 0.5f, z, 1.0f);
- const 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[InstanceIndex];
+ const 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)}};
+ output.color = colors.arr[InstanceIndex];
const tint_symbol_2 tint_symbol_3 = {output.color, output.Position};
return tint_symbol_3;
}
diff --git a/test/intrinsics/gen/atan2/57fb13.wgsl.expected.hlsl b/test/intrinsics/gen/atan2/57fb13.wgsl.expected.hlsl
index f0fcac0..ee9b2b0 100644
--- a/test/intrinsics/gen/atan2/57fb13.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/atan2/57fb13.wgsl.expected.hlsl
@@ -16,10 +16,12 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
atan2_57fb13();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
atan2_57fb13();
diff --git a/test/intrinsics/gen/atan2/a70d0d.wgsl.expected.hlsl b/test/intrinsics/gen/atan2/a70d0d.wgsl.expected.hlsl
index 93e7937..1d5fca9 100644
--- a/test/intrinsics/gen/atan2/a70d0d.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/atan2/a70d0d.wgsl.expected.hlsl
@@ -16,10 +16,12 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
atan2_a70d0d();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
atan2_a70d0d();
diff --git a/test/intrinsics/gen/atan2/ae713e.wgsl.expected.hlsl b/test/intrinsics/gen/atan2/ae713e.wgsl.expected.hlsl
index 8ebbe2e..f5ba1c2 100644
--- a/test/intrinsics/gen/atan2/ae713e.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/atan2/ae713e.wgsl.expected.hlsl
@@ -16,10 +16,12 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
atan2_ae713e();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
atan2_ae713e();
diff --git a/test/intrinsics/gen/fma/26a7a9.wgsl.expected.hlsl b/test/intrinsics/gen/fma/26a7a9.wgsl.expected.hlsl
index a4eeb65..6c1e754 100644
--- a/test/intrinsics/gen/fma/26a7a9.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/fma/26a7a9.wgsl.expected.hlsl
@@ -16,29 +16,31 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
fma_26a7a9();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
fma_26a7a9();
return;
}
-tint_lmSoBx:2:16: error: no matching function for call to 'fma'
+tint_9GH744:2:16: error: no matching function for call to 'fma'
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument
-tint_lmSoBx:2:16: error: no matching function for call to 'fma'
+tint_9GH744:2:16: error: no matching function for call to 'fma'
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument
-tint_lmSoBx:2:16: error: no matching function for call to 'fma'
+tint_9GH744:2:16: error: no matching function for call to 'fma'
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument
diff --git a/test/intrinsics/gen/fma/6a3283.wgsl.expected.hlsl b/test/intrinsics/gen/fma/6a3283.wgsl.expected.hlsl
index 015ee12..5e9e0c9 100644
--- a/test/intrinsics/gen/fma/6a3283.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/fma/6a3283.wgsl.expected.hlsl
@@ -16,29 +16,31 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
fma_6a3283();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
fma_6a3283();
return;
}
-tint_JBvC4T:2:16: error: no matching function for call to 'fma'
+tint_GZ5kFN:2:16: error: no matching function for call to 'fma'
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument
-tint_JBvC4T:2:16: error: no matching function for call to 'fma'
+tint_GZ5kFN:2:16: error: no matching function for call to 'fma'
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument
-tint_JBvC4T:2:16: error: no matching function for call to 'fma'
+tint_GZ5kFN:2:16: error: no matching function for call to 'fma'
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument
diff --git a/test/intrinsics/gen/fma/c10ba3.wgsl.expected.hlsl b/test/intrinsics/gen/fma/c10ba3.wgsl.expected.hlsl
index 21b964e..3181c25 100644
--- a/test/intrinsics/gen/fma/c10ba3.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/fma/c10ba3.wgsl.expected.hlsl
@@ -16,29 +16,31 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
fma_c10ba3();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
fma_c10ba3();
return;
}
-tint_kYorD1:2:15: error: no matching function for call to 'fma'
+tint_tqaLcU:2:15: error: no matching function for call to 'fma'
float res = fma(1.0f, 1.0f, 1.0f);
^~~
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument
-tint_kYorD1:2:15: error: no matching function for call to 'fma'
+tint_tqaLcU:2:15: error: no matching function for call to 'fma'
float res = fma(1.0f, 1.0f, 1.0f);
^~~
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument
-tint_kYorD1:2:15: error: no matching function for call to 'fma'
+tint_tqaLcU:2:15: error: no matching function for call to 'fma'
float res = fma(1.0f, 1.0f, 1.0f);
^~~
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument
diff --git a/test/intrinsics/gen/fma/e17c5c.wgsl.expected.hlsl b/test/intrinsics/gen/fma/e17c5c.wgsl.expected.hlsl
index 8df2067..aa67a89 100644
--- a/test/intrinsics/gen/fma/e17c5c.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/fma/e17c5c.wgsl.expected.hlsl
@@ -16,29 +16,31 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
fma_e17c5c();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
fma_e17c5c();
return;
}
-tint_TfNWAd:2:16: error: no matching function for call to 'fma'
+tint_NJUQps:2:16: error: no matching function for call to 'fma'
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument
-tint_TfNWAd:2:16: error: no matching function for call to 'fma'
+tint_NJUQps:2:16: error: no matching function for call to 'fma'
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument
-tint_TfNWAd:2:16: error: no matching function for call to 'fma'
+tint_NJUQps:2:16: error: no matching function for call to 'fma'
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
^~~
note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument
diff --git a/test/intrinsics/gen/isNan/1280ab.wgsl.expected.hlsl b/test/intrinsics/gen/isNan/1280ab.wgsl.expected.hlsl
index f9cc8b5..1a970ef 100644
--- a/test/intrinsics/gen/isNan/1280ab.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/isNan/1280ab.wgsl.expected.hlsl
@@ -16,10 +16,12 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
isNan_1280ab();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
isNan_1280ab();
diff --git a/test/intrinsics/gen/isNan/4d280d.wgsl.expected.hlsl b/test/intrinsics/gen/isNan/4d280d.wgsl.expected.hlsl
index bc5f879..3632a76 100644
--- a/test/intrinsics/gen/isNan/4d280d.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/isNan/4d280d.wgsl.expected.hlsl
@@ -16,10 +16,12 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
isNan_4d280d();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
isNan_4d280d();
diff --git a/test/intrinsics/gen/isNan/67ecd3.wgsl.expected.hlsl b/test/intrinsics/gen/isNan/67ecd3.wgsl.expected.hlsl
index dada69e..8bba3d1 100644
--- a/test/intrinsics/gen/isNan/67ecd3.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/isNan/67ecd3.wgsl.expected.hlsl
@@ -16,10 +16,12 @@
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
+
void fragment_main() {
isNan_67ecd3();
return;
}
+
[numthreads(1, 1, 1)]
void compute_main() {
isNan_67ecd3();
diff --git a/test/samples/simple_vertex.spvasm.expected.hlsl b/test/samples/simple_vertex.spvasm.expected.hlsl
index cc00f43..2de5412 100644
--- a/test/samples/simple_vertex.spvasm.expected.hlsl
+++ b/test/samples/simple_vertex.spvasm.expected.hlsl
@@ -1,6 +1,6 @@
SKIP: FAILED
-../src/writer/hlsl/generator_impl.cc:1726 internal compiler error: unhandled storage class out
+../src/writer/hlsl/generator_impl.cc:1547 internal compiler error: unhandled storage class out
********************************************************************
* The tint shader compiler has encountered an unexpected error. *
* *
diff --git a/test/samples/triangle.wgsl.expected.hlsl b/test/samples/triangle.wgsl.expected.hlsl
index d290b72..432135c 100644
--- a/test/samples/triangle.wgsl.expected.hlsl
+++ b/test/samples/triangle.wgsl.expected.hlsl
@@ -1,4 +1,8 @@
-static const float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)};
+struct tint_array_wrapper {
+ float2 arr[3];
+};
+
+static const tint_array_wrapper pos = {{float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)}};
struct tint_symbol_1 {
uint VertexIndex : SV_VertexID;
@@ -9,7 +13,7 @@
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
const uint VertexIndex = tint_symbol.VertexIndex;
- const tint_symbol_2 tint_symbol_4 = {float4(pos[VertexIndex], 0.0f, 1.0f)};
+ const tint_symbol_2 tint_symbol_4 = {float4(pos.arr[VertexIndex], 0.0f, 1.0f)};
return tint_symbol_4;
}
diff --git a/test/struct/type_constructor.wgsl.expected.hlsl b/test/struct/type_constructor.wgsl.expected.hlsl
index 3f1bac5..0c23683 100644
--- a/test/struct/type_constructor.wgsl.expected.hlsl
+++ b/test/struct/type_constructor.wgsl.expected.hlsl
@@ -13,8 +13,14 @@
S1 h;
S2 i;
};
+struct tint_array_wrapper {
+ int arr[2];
+};
struct T {
- int a[2];
+ tint_array_wrapper a;
+};
+struct tint_array_wrapper_1 {
+ T arr[2];
};
[numthreads(1, 1, 1)]
@@ -45,14 +51,14 @@
const S1 tint_symbol_11 = {2, x, (x + 1), nested_nonempty.i.f.d};
const S2 tint_symbol_12 = {1, tint_symbol_11};
const S1 subexpr_nested_nonempty_with_expr = tint_symbol_12.f;
- const T aosoa_empty[2] = {{{0, 0}}, {{0, 0}}};
- const int tint_symbol_13[2] = {1, 2};
+ const tint_array_wrapper_1 aosoa_empty = {{{{{0, 0}}}, {{{0, 0}}}}};
+ const tint_array_wrapper tint_symbol_13 = {{1, 2}};
const T tint_symbol_14 = {tint_symbol_13};
- const int tint_symbol_15[2] = {3, 4};
+ const tint_array_wrapper tint_symbol_15 = {{3, 4}};
const T tint_symbol_16 = {tint_symbol_15};
- const T aosoa_nonempty[2] = {tint_symbol_14, tint_symbol_16};
- const int tint_symbol_17[2] = {1, (aosoa_nonempty[0].a[0] + 1)};
+ const tint_array_wrapper_1 aosoa_nonempty = {{tint_symbol_14, tint_symbol_16}};
+ const tint_array_wrapper tint_symbol_17 = {{1, (aosoa_nonempty.arr[0].a.arr[0] + 1)}};
const T tint_symbol_18 = {tint_symbol_17};
- const T aosoa_nonempty_with_expr[2] = {tint_symbol_18, aosoa_nonempty[1]};
+ const tint_array_wrapper_1 aosoa_nonempty_with_expr = {{tint_symbol_18, aosoa_nonempty.arr[1]}};
return;
}
diff --git a/test/types/function_scope_declarations.wgsl.expected.hlsl b/test/types/function_scope_declarations.wgsl.expected.hlsl
index dd70318..10be44a 100644
--- a/test/types/function_scope_declarations.wgsl.expected.hlsl
+++ b/test/types/function_scope_declarations.wgsl.expected.hlsl
@@ -1,5 +1,8 @@
struct S {
};
+struct tint_array_wrapper {
+ float arr[4];
+};
[numthreads(1, 1, 1)]
void main() {
@@ -19,8 +22,8 @@
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);
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);
- float arr_var[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- const float arr_let[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ tint_array_wrapper arr_var = {{0.0f, 0.0f, 0.0f, 0.0f}};
+ const tint_array_wrapper arr_let = {{0.0f, 0.0f, 0.0f, 0.0f}};
S struct_var = {};
const S struct_let = {};
return;
diff --git a/test/types/module_scope_let.wgsl.expected.hlsl b/test/types/module_scope_let.wgsl.expected.hlsl
index 2968e6a..f43a421 100644
--- a/test/types/module_scope_let.wgsl.expected.hlsl
+++ b/test/types/module_scope_let.wgsl.expected.hlsl
@@ -9,7 +9,12 @@
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 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] = {0.0f, 0.0f, 0.0f, 0.0f};
+
+struct tint_array_wrapper {
+ float arr[4];
+};
+
+static const tint_array_wrapper arr_let = {{0.0f, 0.0f, 0.0f, 0.0f}};
static const S struct_let = {};
[numthreads(1, 1, 1)]
diff --git a/test/types/module_scope_var.wgsl.expected.hlsl b/test/types/module_scope_var.wgsl.expected.hlsl
index de2813f..d5ffa61 100644
--- a/test/types/module_scope_var.wgsl.expected.hlsl
+++ b/test/types/module_scope_var.wgsl.expected.hlsl
@@ -9,7 +9,12 @@
static uint3 v3u32_var;
static float4 v4f32_var;
static float2x3 m2x3_var;
-static float arr_var[4];
+
+struct tint_array_wrapper {
+ float arr[4];
+};
+
+static tint_array_wrapper arr_var;
static S struct_var;
[numthreads(1, 1, 1)]
@@ -22,7 +27,7 @@
v3u32_var = uint3(0u, 0u, 0u);
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);
- const float tint_symbol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ const tint_array_wrapper tint_symbol = {{0.0f, 0.0f, 0.0f, 0.0f}};
arr_var = tint_symbol;
const S tint_symbol_1 = {};
struct_var = tint_symbol_1;
diff --git a/test/types/module_scope_var_initializers.wgsl.expected.hlsl b/test/types/module_scope_var_initializers.wgsl.expected.hlsl
index 769f545..176ade4 100644
--- a/test/types/module_scope_var_initializers.wgsl.expected.hlsl
+++ b/test/types/module_scope_var_initializers.wgsl.expected.hlsl
@@ -9,7 +9,12 @@
static uint3 v3u32_var = uint3(0u, 0u, 0u);
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 float arr_var[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+
+struct tint_array_wrapper {
+ float arr[4];
+};
+
+static tint_array_wrapper arr_var = {{0.0f, 0.0f, 0.0f, 0.0f}};
static S struct_var = {};
[numthreads(1, 1, 1)]
@@ -22,7 +27,7 @@
v3u32_var = uint3(0u, 0u, 0u);
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);
- const float tint_symbol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ const tint_array_wrapper tint_symbol = {{0.0f, 0.0f, 0.0f, 0.0f}};
arr_var = tint_symbol;
const S tint_symbol_1 = {};
struct_var = tint_symbol_1;
diff --git a/test/types/parameters.wgsl.expected.hlsl b/test/types/parameters.wgsl.expected.hlsl
index a5d15d9..a6f80fc 100644
--- a/test/types/parameters.wgsl.expected.hlsl
+++ b/test/types/parameters.wgsl.expected.hlsl
@@ -1,7 +1,10 @@
struct S {
};
+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, float param_arr[4], S param_struct, inout float param_ptr_f32, inout float4 param_ptr_vec, inout float param_ptr_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) {
}
[numthreads(1, 1, 1)]
diff --git a/test/types/return_types.wgsl.expected.hlsl b/test/types/return_types.wgsl.expected.hlsl
index e804ba1..f8d31a2 100644
--- a/test/types/return_types.wgsl.expected.hlsl
+++ b/test/types/return_types.wgsl.expected.hlsl
@@ -1,50 +1,53 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
struct S {
};
bool ret_bool() {
return false;
}
+
int ret_i32() {
return 0;
}
+
uint ret_u32() {
return 0u;
}
+
float ret_f32() {
return 0.0f;
}
+
int2 ret_v2i32() {
return int2(0, 0);
}
+
uint3 ret_v3u32() {
return uint3(0u, 0u, 0u);
}
+
float4 ret_v4f32() {
return float4(0.0f, 0.0f, 0.0f, 0.0f);
}
+
float2x3 ret_m2x3() {
return float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
}
-float[4] ret_arr() {
- const float tint_symbol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+
+struct tint_array_wrapper {
+ float arr[4];
+};
+
+tint_array_wrapper ret_arr() {
+ const tint_array_wrapper tint_symbol = {{0.0f, 0.0f, 0.0f, 0.0f}};
return tint_symbol;
}
+
S ret_struct() {
const S tint_symbol_1 = {};
return tint_symbol_1;
}
+
[numthreads(1, 1, 1)]
void main() {
return;
}
-
-tint_rjGobz:28:19: error: brackets are not allowed here; to declare an array, place the brackets after the name
-float[4] ret_arr() {
- ~~~ ^
- [4]
-
diff --git a/test/types/struct_members.wgsl.expected.hlsl b/test/types/struct_members.wgsl.expected.hlsl
index cff148e..071c667 100644
--- a/test/types/struct_members.wgsl.expected.hlsl
+++ b/test/types/struct_members.wgsl.expected.hlsl
@@ -1,5 +1,8 @@
struct S_inner {
};
+struct tint_array_wrapper {
+ float arr[4];
+};
struct S {
bool member_bool;
int member_i32;
@@ -9,12 +12,12 @@
uint3 member_v3u32;
float4 member_v4f32;
float2x3 member_m2x3;
- float member_arr[4];
+ tint_array_wrapper member_arr;
S_inner member_struct;
};
[numthreads(1, 1, 1)]
void main() {
- const S s = {false, 0, 0u, 0.0f, int2(0, 0), uint3(0u, 0u, 0u), float4(0.0f, 0.0f, 0.0f, 0.0f), float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), {0.0f, 0.0f, 0.0f, 0.0f}, {}};
+ const S s = {false, 0, 0u, 0.0f, int2(0, 0), uint3(0u, 0u, 0u), float4(0.0f, 0.0f, 0.0f, 0.0f), float2x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f), {{0.0f, 0.0f, 0.0f, 0.0f}}, {}};
return;
}
diff --git a/test/var/inferred/function-let.wgsl.expected.hlsl b/test/var/inferred/function-let.wgsl.expected.hlsl
index 965527d..799c492 100644
--- a/test/var/inferred/function-let.wgsl.expected.hlsl
+++ b/test/var/inferred/function-let.wgsl.expected.hlsl
@@ -1,29 +1,32 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
struct MyStruct {
float f1;
};
+struct tint_array_wrapper {
+ float arr[10];
+};
int ret_i32() {
return 1;
}
+
uint ret_u32() {
return 1u;
}
+
float ret_f32() {
return 1.0f;
}
+
MyStruct ret_MyStruct() {
const MyStruct tint_symbol_1 = {0.0f};
return tint_symbol_1;
}
-float[10] ret_MyArray() {
- const float tint_symbol_2[10] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
+
+tint_array_wrapper ret_MyArray() {
+ const tint_array_wrapper tint_symbol_2 = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
return tint_symbol_2;
}
+
void let_decls() {
const int v1 = 1;
const uint v2 = 1u;
@@ -33,13 +36,13 @@
const float3 v6 = float3(1.0f, 1.0f, 1.0f);
const float3x3 v7 = float3x3(v6, v6, v6);
const MyStruct v8 = {1.0f};
- const float v9[10] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
+ const tint_array_wrapper v9 = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
const int v10 = ret_i32();
const uint v11 = ret_u32();
const float v12 = ret_f32();
const MyStruct v13 = ret_MyStruct();
const MyStruct v14 = ret_MyStruct();
- const float v15[10] = ret_MyArray();
+ const tint_array_wrapper v15 = ret_MyArray();
}
struct tint_symbol {
@@ -50,9 +53,3 @@
const tint_symbol tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_3;
}
-
-tint_1dFgAw:18:24: error: brackets are not allowed here; to declare an array, place the brackets after the name
-float[10] ret_MyArray() {
- ~~~~ ^
- [10]
-
diff --git a/test/var/inferred/function-var.wgsl.expected.hlsl b/test/var/inferred/function-var.wgsl.expected.hlsl
index 7bea41fd..bffba22 100644
--- a/test/var/inferred/function-var.wgsl.expected.hlsl
+++ b/test/var/inferred/function-var.wgsl.expected.hlsl
@@ -1,29 +1,32 @@
-SKIP: FAILED
-
-
-
-Validation Failure:
struct MyStruct {
float f1;
};
+struct tint_array_wrapper {
+ float arr[10];
+};
int ret_i32() {
return 1;
}
+
uint ret_u32() {
return 1u;
}
+
float ret_f32() {
return 1.0f;
}
+
MyStruct ret_MyStruct() {
const MyStruct tint_symbol_1 = {0.0f};
return tint_symbol_1;
}
-float[10] ret_MyArray() {
- const float tint_symbol_2[10] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
+
+tint_array_wrapper ret_MyArray() {
+ const tint_array_wrapper tint_symbol_2 = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
return tint_symbol_2;
}
+
void var_decls() {
int v1 = 1;
uint v2 = 1u;
@@ -33,13 +36,13 @@
float3 v6 = float3(1.0f, 1.0f, 1.0f);
float3x3 v7 = float3x3(v6, v6, v6);
MyStruct v8 = {1.0f};
- float v9[10] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
+ tint_array_wrapper v9 = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
int v10 = ret_i32();
uint v11 = ret_u32();
float v12 = ret_f32();
MyStruct v13 = ret_MyStruct();
MyStruct v14 = ret_MyStruct();
- float v15[10] = ret_MyArray();
+ tint_array_wrapper v15 = ret_MyArray();
}
struct tint_symbol {
@@ -50,9 +53,3 @@
const tint_symbol tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_3;
}
-
-tint_W6AplI:18:24: error: brackets are not allowed here; to declare an array, place the brackets after the name
-float[10] ret_MyArray() {
- ~~~~ ^
- [10]
-
diff --git a/test/var/inferred/global-let.wgsl.expected.hlsl b/test/var/inferred/global-let.wgsl.expected.hlsl
index 8043021..590b15d 100644
--- a/test/var/inferred/global-let.wgsl.expected.hlsl
+++ b/test/var/inferred/global-let.wgsl.expected.hlsl
@@ -1,6 +1,9 @@
struct MyStruct {
float f1;
};
+struct tint_array_wrapper {
+ float arr[10];
+};
static const int v1 = 1;
static const uint v2 = 1u;
@@ -10,7 +13,7 @@
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 MyStruct v8 = {0.0f};
-static const float v9[10] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
+static const tint_array_wrapper v9 = {{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
struct tint_symbol {
float4 value : SV_Target0;