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>
This commit is contained in:
Ben Clayton 2021-06-16 09:19:36 +00:00 committed by Ben Clayton
parent 0597a2b51b
commit 9ef52ffd8c
38 changed files with 437 additions and 308 deletions

View File

@ -25,6 +25,7 @@
#include "src/transform/manager.h" #include "src/transform/manager.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"
namespace tint { namespace tint {
namespace transform { namespace transform {
@ -50,6 +51,7 @@ 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>();
data.Add<CanonicalizeEntryPointIO::Config>( data.Add<CanonicalizeEntryPointIO::Config>(
CanonicalizeEntryPointIO::BuiltinStyle::kStructMember); CanonicalizeEntryPointIO::BuiltinStyle::kStructMember);
auto out = manager.Run(in, data); auto out = manager.Run(in, data);

View File

@ -763,15 +763,39 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
Return(), Return(),
}); });
GeneratorImpl& gen = Build(); GeneratorImpl& gen = SanitizeAndBuild();
gen.increment_indent();
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
EXPECT_EQ(result(), R"( void my_func(float a[5]) { EXPECT_THAT(result(), HasSubstr(R"(
struct tint_array_wrapper {
float arr[5];
};
void my_func(tint_array_wrapper a) {
return; 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 // https://crbug.com/tint/297

View File

@ -206,9 +206,13 @@ TEST_F(HlslSanitizerTest, PromoteArrayInitializerToConstVar) {
ASSERT_TRUE(gen.Generate(out)) << gen.error(); ASSERT_TRUE(gen.Generate(out)) << gen.error();
auto got = result(); auto got = result();
auto* expect = R"(void main() { auto* expect = R"(struct tint_array_wrapper {
const int tint_symbol[4] = {1, 2, 3, 4}; int arr[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

@ -1,43 +1,53 @@
SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
struct S { struct tint_array_wrapper {
int arr[4]; int arr[4];
}; };
struct S {
tint_array_wrapper arr;
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { tint_array_wrapper 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)))}; 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; return tint_symbol_3;
} }
static int src_private[4]; static tint_array_wrapper src_private;
groupshared int src_workgroup[4]; groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0); ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0); RWByteAddressBuffer src_storage : register(u1, space0);
int[4] ret_arr() { tint_array_wrapper ret_arr() {
const int tint_symbol_4[4] = {0, 0, 0, 0}; const tint_array_wrapper tint_symbol_4 = {{0, 0, 0, 0}};
return tint_symbol_4; return tint_symbol_4;
} }
S ret_struct_arr() { 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; return tint_symbol_5;
} }
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0}; struct tint_array_wrapper_3 {
int tint_symbol[4] = {0, 0, 0, 0}; int arr[2];
const int tint_symbol_6[4] = {1, 2, 3, 3}; };
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 = tint_symbol_6;
tint_symbol = src_param; tint_symbol = src_param;
tint_symbol = ret_arr(); 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_let;
tint_symbol = src_function; tint_symbol = src_function;
tint_symbol = src_private; tint_symbol = src_private;
@ -45,17 +55,7 @@ void foo(int src_param[4]) {
tint_symbol = ret_struct_arr().arr; tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr; tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u); 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}}}; 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}}}}}};
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; 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]

View File

@ -1,44 +1,55 @@
SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
struct S { struct tint_array_wrapper {
int arr[4]; int arr[4];
}; };
struct S {
tint_array_wrapper arr;
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { tint_array_wrapper 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)))}; 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; return tint_symbol_3;
} }
static int src_private[4]; static tint_array_wrapper src_private;
groupshared int src_workgroup[4]; groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0); ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0); RWByteAddressBuffer src_storage : register(u1, space0);
static int tint_symbol[4]; static tint_array_wrapper tint_symbol;
static int dst_nested[4][3][2];
int[4] ret_arr() { struct tint_array_wrapper_3 {
const int tint_symbol_4[4] = {0, 0, 0, 0}; 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; return tint_symbol_4;
} }
S ret_struct_arr() { 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; return tint_symbol_5;
} }
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0}; void foo(tint_array_wrapper src_param) {
const int tint_symbol_6[4] = {1, 2, 3, 3}; 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 = tint_symbol_6;
tint_symbol = src_param; tint_symbol = src_param;
tint_symbol = ret_arr(); 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_let;
tint_symbol = src_function; tint_symbol = src_function;
tint_symbol = src_private; tint_symbol = src_private;
@ -46,16 +57,6 @@ void foo(int src_param[4]) {
tint_symbol = ret_struct_arr().arr; tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr; tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u); 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; 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]

View File

@ -1,66 +1,79 @@
SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
struct S { struct tint_array_wrapper {
int arr[4]; int arr[4];
}; };
struct S {
tint_array_wrapper arr;
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { tint_array_wrapper 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)))}; 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; return tint_symbol_9;
} }
void tint_symbol_4(RWByteAddressBuffer buffer, uint offset, int value[4]) {
buffer.Store((offset + 0u), asuint(value[0u])); void tint_symbol_4(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper value) {
buffer.Store((offset + 16u), asuint(value[1u])); buffer.Store((offset + 0u), asuint(value.arr[0u]));
buffer.Store((offset + 32u), asuint(value[2u])); buffer.Store((offset + 16u), asuint(value.arr[1u]));
buffer.Store((offset + 48u), asuint(value[3u])); 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]) { struct tint_array_wrapper_3 {
buffer.Store((offset + 0u), asuint(value[0u])); int arr[2];
buffer.Store((offset + 4u), asuint(value[1u])); };
} struct tint_array_wrapper_2 {
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[3][2]) { tint_array_wrapper_3 arr[3];
tint_symbol_6(buffer, (offset + 0u), value[0u]); };
tint_symbol_6(buffer, (offset + 8u), value[1u]); struct tint_array_wrapper_1 {
tint_symbol_6(buffer, (offset + 16u), value[2u]); tint_array_wrapper_2 arr[4];
} };
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
tint_symbol_7(buffer, (offset + 0u), value[0u]); void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_3 value) {
tint_symbol_7(buffer, (offset + 24u), value[1u]); buffer.Store((offset + 0u), asuint(value.arr[0u]));
tint_symbol_7(buffer, (offset + 48u), value[2u]); buffer.Store((offset + 4u), asuint(value.arr[1u]));
tint_symbol_7(buffer, (offset + 72u), value[3u]);
} }
static int src_private[4]; void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, tint_array_wrapper_2 value) {
groupshared int src_workgroup[4]; 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); ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0); 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);
int[4] ret_arr() { tint_array_wrapper ret_arr() {
const int tint_symbol_10[4] = {0, 0, 0, 0}; const tint_array_wrapper tint_symbol_10 = {{0, 0, 0, 0}};
return tint_symbol_10; return tint_symbol_10;
} }
S ret_struct_arr() { 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; return tint_symbol_11;
} }
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0}; void foo(tint_array_wrapper src_param) {
const int tint_symbol_12[4] = {1, 2, 3, 3}; 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, tint_symbol_12);
tint_symbol_4(tint_symbol, 0u, src_param); tint_symbol_4(tint_symbol, 0u, src_param);
tint_symbol_4(tint_symbol, 0u, ret_arr()); 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_let);
tint_symbol_4(tint_symbol, 0u, src_function); tint_symbol_4(tint_symbol, 0u, src_function);
tint_symbol_4(tint_symbol, 0u, src_private); tint_symbol_4(tint_symbol, 0u, src_private);
@ -68,16 +81,6 @@ void foo(int src_param[4]) {
tint_symbol_4(tint_symbol, 0u, ret_struct_arr().arr); 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, src_uniform.arr);
tint_symbol_4(tint_symbol, 0u, tint_symbol_2(src_storage, 0u)); 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_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]

View File

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

View File

@ -1,44 +1,55 @@
SKIP: FAILED
Validation Failure:
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void unused_entry_point() { void unused_entry_point() {
return; return;
} }
struct S { struct tint_array_wrapper {
int arr[4]; int arr[4];
}; };
struct S {
tint_array_wrapper arr;
};
int[4] tint_symbol_2(RWByteAddressBuffer buffer, uint offset) { tint_array_wrapper 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)))}; 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; return tint_symbol_3;
} }
static int src_private[4]; static tint_array_wrapper src_private;
groupshared int src_workgroup[4]; groupshared tint_array_wrapper src_workgroup;
ConstantBuffer<S> src_uniform : register(b0, space0); ConstantBuffer<S> src_uniform : register(b0, space0);
RWByteAddressBuffer src_storage : register(u1, space0); RWByteAddressBuffer src_storage : register(u1, space0);
groupshared int tint_symbol[4]; groupshared tint_array_wrapper tint_symbol;
groupshared int dst_nested[4][3][2];
int[4] ret_arr() { struct tint_array_wrapper_3 {
const int tint_symbol_4[4] = {0, 0, 0, 0}; 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; return tint_symbol_4;
} }
S ret_struct_arr() { 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; return tint_symbol_5;
} }
void foo(int src_param[4]) {
int src_function[4] = {0, 0, 0, 0}; void foo(tint_array_wrapper src_param) {
const int tint_symbol_6[4] = {1, 2, 3, 3}; 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 = tint_symbol_6;
tint_symbol = src_param; tint_symbol = src_param;
tint_symbol = ret_arr(); 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_let;
tint_symbol = src_function; tint_symbol = src_function;
tint_symbol = src_private; tint_symbol = src_private;
@ -46,16 +57,6 @@ void foo(int src_param[4]) {
tint_symbol = ret_struct_arr().arr; tint_symbol = ret_struct_arr().arr;
tint_symbol = src_uniform.arr; tint_symbol = src_uniform.arr;
tint_symbol = tint_symbol_2(src_storage, 0u); 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; 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]

View File

@ -1,20 +1,32 @@
float f1(float a[4]) { struct tint_array_wrapper {
return a[3]; float arr[4];
};
float f1(tint_array_wrapper a) {
return a.arr[3];
} }
float f2(float a[3][4]) { struct tint_array_wrapper_1 {
return a[2][3]; 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]) { struct tint_array_wrapper_2 {
return a[1][2][3]; 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)] [numthreads(1, 1, 1)]
void main() { void main() {
const float a1[4] = {0.0f, 0.0f, 0.0f, 0.0f}; const tint_array_wrapper a1 = {{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 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 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_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 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,38 +1,34 @@
SKIP: FAILED struct tint_array_wrapper {
float arr[4];
};
tint_array_wrapper f1() {
const tint_array_wrapper tint_symbol = {{0.0f, 0.0f, 0.0f, 0.0f}};
Validation Failure:
float[4] f1() {
const float tint_symbol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
return tint_symbol; 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; 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; return tint_symbol_2;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const float a1[4] = f1(); const tint_array_wrapper a1 = f1();
const float a2[3][4] = f2(); const tint_array_wrapper_1 a2 = f2();
const float a3[2][3][4] = f3(); const tint_array_wrapper_2 a3 = f3();
return; 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]

View File

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

View File

@ -19,16 +19,19 @@ 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 int gl_VertexIndex = tint_symbol.gl_VertexIndex; 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_23 = x_20.transform1;
const float2x2 x_28 = x_26.transform2; const float2x2 x_28 = x_26.transform2;
const int x_46 = gl_VertexIndex; 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; 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 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)}; const tint_symbol_2 tint_symbol_4 = {float4(x_52.x, x_52.y, 0.0f, 1.0f)};
return tint_symbol_4; return tint_symbol_4;

View File

@ -1,6 +1,6 @@
SKIP: FAILED 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. * * The tint shader compiler has encountered an unexpected error. *
* * * *

View File

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

View File

@ -10,16 +10,22 @@ 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;
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 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[InstanceIndex].x; 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 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); 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)}; 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[InstanceIndex]; output.color = colors.arr[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

@ -16,10 +16,12 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
atan2_57fb13(); atan2_57fb13();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
atan2_57fb13(); atan2_57fb13();

View File

@ -16,10 +16,12 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
atan2_a70d0d(); atan2_a70d0d();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
atan2_a70d0d(); atan2_a70d0d();

View File

@ -16,10 +16,12 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
atan2_ae713e(); atan2_ae713e();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
atan2_ae713e(); atan2_ae713e();

View File

@ -16,29 +16,31 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
fma_26a7a9(); fma_26a7a9();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
fma_26a7a9(); fma_26a7a9();
return; 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)); 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 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)); 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 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)); 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 note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument

View File

@ -16,29 +16,31 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
fma_6a3283(); fma_6a3283();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
fma_6a3283(); fma_6a3283();
return; 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)); 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 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)); 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 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)); 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 note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument

View File

@ -16,29 +16,31 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
fma_c10ba3(); fma_c10ba3();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
fma_c10ba3(); fma_c10ba3();
return; 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); float res = fma(1.0f, 1.0f, 1.0f);
^~~ ^~~
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument 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); float res = fma(1.0f, 1.0f, 1.0f);
^~~ ^~~
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument 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); float res = fma(1.0f, 1.0f, 1.0f);
^~~ ^~~
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument

View File

@ -16,29 +16,31 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
fma_e17c5c(); fma_e17c5c();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
fma_e17c5c(); fma_e17c5c();
return; 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)); 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 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)); 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 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)); 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 note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument

View File

@ -16,10 +16,12 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
isNan_1280ab(); isNan_1280ab();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
isNan_1280ab(); isNan_1280ab();

View File

@ -16,10 +16,12 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
isNan_4d280d(); isNan_4d280d();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
isNan_4d280d(); isNan_4d280d();

View File

@ -16,10 +16,12 @@ tint_symbol vertex_main() {
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1; return tint_symbol_1;
} }
void fragment_main() { void fragment_main() {
isNan_67ecd3(); isNan_67ecd3();
return; return;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void compute_main() { void compute_main() {
isNan_67ecd3(); isNan_67ecd3();

View File

@ -1,6 +1,6 @@
SKIP: FAILED 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. * * The tint shader compiler has encountered an unexpected error. *
* * * *

View File

@ -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 { struct tint_symbol_1 {
uint VertexIndex : SV_VertexID; uint VertexIndex : SV_VertexID;
@ -9,7 +13,7 @@ struct tint_symbol_2 {
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;
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; return tint_symbol_4;
} }

View File

@ -13,8 +13,14 @@ struct S3 {
S1 h; S1 h;
S2 i; S2 i;
}; };
struct tint_array_wrapper {
int arr[2];
};
struct T { struct T {
int a[2]; tint_array_wrapper a;
};
struct tint_array_wrapper_1 {
T arr[2];
}; };
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -45,14 +51,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 T aosoa_empty[2] = {{{0, 0}}, {{0, 0}}}; const tint_array_wrapper_1 aosoa_empty = {{{{{0, 0}}}, {{{0, 0}}}}};
const int tint_symbol_13[2] = {1, 2}; const tint_array_wrapper tint_symbol_13 = {{1, 2}};
const T tint_symbol_14 = {tint_symbol_13}; 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 tint_symbol_16 = {tint_symbol_15};
const T aosoa_nonempty[2] = {tint_symbol_14, tint_symbol_16}; const tint_array_wrapper_1 aosoa_nonempty = {{tint_symbol_14, tint_symbol_16}};
const int tint_symbol_17[2] = {1, (aosoa_nonempty[0].a[0] + 1)}; 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 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; return;
} }

View File

@ -1,5 +1,8 @@
struct S { struct S {
}; };
struct tint_array_wrapper {
float arr[4];
};
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
@ -19,8 +22,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);
float arr_var[4] = {0.0f, 0.0f, 0.0f, 0.0f}; tint_array_wrapper arr_var = {{0.0f, 0.0f, 0.0f, 0.0f}};
const float arr_let[4] = {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 = {}; S struct_var = {};
const S struct_let = {}; const S struct_let = {};
return; return;

View File

@ -9,7 +9,12 @@ 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] = {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 = {}; static const S struct_let = {};
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -9,7 +9,12 @@ static int2 v2i32_var;
static uint3 v3u32_var; static uint3 v3u32_var;
static float4 v4f32_var; static float4 v4f32_var;
static float2x3 m2x3_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; static S struct_var;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -22,7 +27,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 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; arr_var = tint_symbol;
const S tint_symbol_1 = {}; const S tint_symbol_1 = {};
struct_var = tint_symbol_1; struct_var = tint_symbol_1;

View File

@ -9,7 +9,12 @@ 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] = {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 = {}; static S struct_var = {};
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
@ -22,7 +27,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 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; arr_var = tint_symbol;
const S tint_symbol_1 = {}; const S tint_symbol_1 = {};
struct_var = tint_symbol_1; struct_var = tint_symbol_1;

View File

@ -1,7 +1,10 @@
struct S { 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)] [numthreads(1, 1, 1)]

View File

@ -1,50 +1,53 @@
SKIP: FAILED
Validation Failure:
struct S { struct S {
}; };
bool ret_bool() { bool ret_bool() {
return false; return false;
} }
int ret_i32() { int ret_i32() {
return 0; return 0;
} }
uint ret_u32() { uint ret_u32() {
return 0u; return 0u;
} }
float ret_f32() { float ret_f32() {
return 0.0f; return 0.0f;
} }
int2 ret_v2i32() { int2 ret_v2i32() {
return int2(0, 0); return int2(0, 0);
} }
uint3 ret_v3u32() { uint3 ret_v3u32() {
return uint3(0u, 0u, 0u); return uint3(0u, 0u, 0u);
} }
float4 ret_v4f32() { float4 ret_v4f32() {
return float4(0.0f, 0.0f, 0.0f, 0.0f); return float4(0.0f, 0.0f, 0.0f, 0.0f);
} }
float2x3 ret_m2x3() { 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);
} }
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; return tint_symbol;
} }
S ret_struct() { S ret_struct() {
const S tint_symbol_1 = {}; const S tint_symbol_1 = {};
return tint_symbol_1; return tint_symbol_1;
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
return; 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]

View File

@ -1,5 +1,8 @@
struct S_inner { struct S_inner {
}; };
struct tint_array_wrapper {
float arr[4];
};
struct S { struct S {
bool member_bool; bool member_bool;
int member_i32; int member_i32;
@ -9,12 +12,12 @@ struct S {
uint3 member_v3u32; uint3 member_v3u32;
float4 member_v4f32; float4 member_v4f32;
float2x3 member_m2x3; float2x3 member_m2x3;
float member_arr[4]; tint_array_wrapper member_arr;
S_inner member_struct; S_inner member_struct;
}; };
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { 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; return;
} }

View File

@ -1,29 +1,32 @@
SKIP: FAILED
Validation Failure:
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;
} }
uint ret_u32() { uint ret_u32() {
return 1u; return 1u;
} }
float ret_f32() { float ret_f32() {
return 1.0f; return 1.0f;
} }
MyStruct ret_MyStruct() { MyStruct ret_MyStruct() {
const MyStruct tint_symbol_1 = {0.0f}; const MyStruct tint_symbol_1 = {0.0f};
return tint_symbol_1; 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; return tint_symbol_2;
} }
void let_decls() { void let_decls() {
const int v1 = 1; const int v1 = 1;
const uint v2 = 1u; const uint v2 = 1u;
@ -33,13 +36,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 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 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 float v15[10] = ret_MyArray(); const tint_array_wrapper v15 = ret_MyArray();
} }
struct tint_symbol { struct tint_symbol {
@ -50,9 +53,3 @@ tint_symbol main() {
const tint_symbol tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_3; 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]

View File

@ -1,29 +1,32 @@
SKIP: FAILED
Validation Failure:
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;
} }
uint ret_u32() { uint ret_u32() {
return 1u; return 1u;
} }
float ret_f32() { float ret_f32() {
return 1.0f; return 1.0f;
} }
MyStruct ret_MyStruct() { MyStruct ret_MyStruct() {
const MyStruct tint_symbol_1 = {0.0f}; const MyStruct tint_symbol_1 = {0.0f};
return tint_symbol_1; 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; return tint_symbol_2;
} }
void var_decls() { void var_decls() {
int v1 = 1; int v1 = 1;
uint v2 = 1u; uint v2 = 1u;
@ -33,13 +36,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};
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(); 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();
float v15[10] = ret_MyArray(); tint_array_wrapper v15 = ret_MyArray();
} }
struct tint_symbol { struct tint_symbol {
@ -50,9 +53,3 @@ tint_symbol main() {
const tint_symbol tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f)}; const tint_symbol tint_symbol_3 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_3; 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]

View File

@ -1,6 +1,9 @@
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;
@ -10,7 +13,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 = {0.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 { struct tint_symbol {
float4 value : SV_Target0; float4 value : SV_Target0;