wgsl: Do not require a semicolon after a struct

Don't generate them either, which generated a lot of test churn.

Fixed: tint:1380
Change-Id: I0a7cfdd2ef0ffe8e7fda111fbc57997b36b949e0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/77165
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price 2022-01-19 18:11:17 +00:00
parent ecf43d69d0
commit 6b1e5f552b
250 changed files with 796 additions and 791 deletions

View File

@ -19,6 +19,7 @@ The following features have been deprecated and will be removed in M102:
* Added builtins `degrees()` and `radians()` for converting between degrees and radians. [tint:1329](https://crbug.com/tint/1329)
* `let` arrays and matrices can now be dynamically indexed. [tint:1352](https://crbug.com/tint/1352)
* Storage and Uniform buffer types no longer have to be structures. [tint:1372](crbug.com/tint/1372)
* A struct declaration does not have to be followed by a semicolon. [tint:1380](crbug.com/tint/1380)
### Fixes

View File

@ -955,7 +955,7 @@ TEST_F(SpvParserMemoryTest, RemapStorageBuffer_TypesAndVarDeclarations) {
struct S {
field0 : u32;
field1 : RTArr;
};
}
[[group(0), binding(0)]] var<storage, read_write> myvar : S;
)"));

View File

@ -126,7 +126,7 @@ OpFunctionEnd)";
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
)")) << program_ast;
EXPECT_THAT(program_ast, HasSubstr(R"(

View File

@ -473,7 +473,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -533,7 +533,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -592,7 +592,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -651,7 +651,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -709,7 +709,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -767,7 +767,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -803,7 +803,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -1405,7 +1405,7 @@ struct S {
field0 : u32;
field1 : f32;
field2 : Arr;
};
}
[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
)")) << module_str;
@ -1435,7 +1435,7 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) {
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : mat3x2<f32>;
};
}
[[group(0), binding(0)]] var<storage, read_write> myvar : S;
)")) << module_str;
@ -1464,7 +1464,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Natural_Dropped) {
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : mat3x2<f32>;
};
}
[[group(0), binding(0)]] var<storage, read_write> myvar : S;
)")) << module_str;
@ -1494,7 +1494,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration) {
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
[[stride(64), internal(disable_validation__ignore_stride)]]
field0 : mat3x2<f32>;
};
}
[[group(0), binding(0)]] var<storage, read_write> myvar : S;
)")) << module_str;
@ -1547,7 +1547,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_AllMembers) {
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : f32;
field1 : f32;
};
}
[[group(0), binding(0)]] var<storage, read> x_1 : S;
)")) << module_str;
@ -1576,7 +1576,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_NotAllMembers) {
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : f32;
field1 : f32;
};
}
[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
)")) << module_str;
@ -1608,7 +1608,7 @@ TEST_F(
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : f32;
field1 : f32;
};
}
[[group(0), binding(0)]] var<storage, read_write> x_1 : S;
)")) << module_str;
@ -2364,7 +2364,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2401,7 +2401,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2438,7 +2438,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2474,7 +2474,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2511,7 +2511,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2548,7 +2548,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2631,7 +2631,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -2689,7 +2689,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
@ -2727,7 +2727,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
@ -2764,7 +2764,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
@ -2800,7 +2800,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
@ -2838,7 +2838,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
@ -2875,7 +2875,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] x_1_param : u32) -> main_out {
@ -2960,7 +2960,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
position_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -2998,7 +2998,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
position_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3035,7 +3035,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
position_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3095,7 +3095,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
position_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3133,7 +3133,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
position_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3170,7 +3170,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
position_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3734,7 +3734,7 @@ struct main_out {
x_2_1 : u32;
[[location(6)]]
x_4_1 : u32;
};
}
[[stage(fragment)]]
fn main([[location(0)]] x_1_param : u32, [[location(30)]] x_3_param : u32) -> main_out {
@ -3786,7 +3786,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3836,7 +3836,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_4_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(instance_index)]] x_1_param : u32) -> main_out {
@ -3962,7 +3962,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -4008,7 +4008,7 @@ fn main_1() {
struct main_out {
[[builtin(sample_mask)]]
x_1_1 : u32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -4052,7 +4052,7 @@ fn main_1() {
struct main_out {
[[builtin(frag_depth)]]
x_1_1 : f32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -4086,7 +4086,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -4156,7 +4156,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -4213,7 +4213,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[location(4)]] x_1_param : f32, [[location(5)]] x_1_param_1 : f32, [[location(6)]] x_1_param_2 : f32) -> main_out {
@ -4271,7 +4271,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[location(9)]] x_1_param : vec4<f32>, [[location(10)]] x_1_param_1 : vec4<f32>) -> main_out {
@ -4325,7 +4325,7 @@ TEST_F(SpvModuleScopeVarParserTest, Input_FlattenStruct_LocOnVariable) {
const std::string expected = R"(struct Communicators {
alice : f32;
bob : vec4<f32>;
};
}
var<private> x_1 : Communicators;
@ -4338,7 +4338,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[location(9)]] x_1_param : f32, [[location(10)]] x_1_param_1 : vec4<f32>) -> main_out {
@ -4397,7 +4397,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[location(7)]] x_1_param : vec4<f32>, [[location(8)]] x_1_param_1 : vec4<f32>, [[location(9)]] x_1_param_2 : vec4<f32>, [[location(10)]] x_1_param_3 : vec4<f32>) -> main_out {
@ -4464,7 +4464,7 @@ struct main_out {
x_1_3 : f32;
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -4523,7 +4523,7 @@ struct main_out {
x_1_2 : vec4<f32>;
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -4575,7 +4575,7 @@ TEST_F(SpvModuleScopeVarParserTest, Output_FlattenStruct_LocOnVariable) {
const std::string expected = R"(struct Communicators {
alice : f32;
bob : vec4<f32>;
};
}
var<private> x_1 : Communicators;
@ -4592,7 +4592,7 @@ struct main_out {
x_1_2 : vec4<f32>;
[[builtin(position)]]
x_2_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -4648,7 +4648,7 @@ TEST_F(SpvModuleScopeVarParserTest, FlattenStruct_LocOnMembers) {
const std::string expected = R"(struct Communicators {
alice : f32;
bob : vec4<f32>;
};
}
var<private> x_1 : Communicators;
@ -4667,7 +4667,7 @@ struct main_out {
x_3_1 : f32;
[[location(11)]]
x_3_2 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[location(9)]] x_1_param : f32, [[location(11)]] x_1_param_1 : vec4<f32>) -> main_out {
@ -4748,7 +4748,7 @@ fn main_1() {
struct main_out {
[[builtin(position)]]
x_10_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[location(1), interpolate(flat)]] x_1_param : u32, [[location(2), interpolate(flat)]] x_2_param : vec2<u32>, [[location(3), interpolate(flat)]] x_3_param : i32, [[location(4), interpolate(flat)]] x_4_param : vec2<i32>, [[location(5), interpolate(flat)]] x_5_param : f32, [[location(6), interpolate(flat)]] x_6_param : vec2<f32>) -> main_out {
@ -4845,7 +4845,7 @@ struct main_out {
x_6_1 : vec2<f32>;
[[builtin(position)]]
x_10_1 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main() -> main_out {
@ -4889,7 +4889,7 @@ TEST_F(SpvModuleScopeVarParserTest,
R"(struct S {
field0 : f32;
field1 : f32;
};
}
var<private> x_1 : array<f32, 2u>;
@ -5035,7 +5035,7 @@ TEST_F(SpvModuleScopeVarParserTest,
field3 : f32;
field4 : f32;
field5 : f32;
};
}
var<private> x_1 : S;
@ -5134,7 +5134,7 @@ struct main_out {
x_5_1 : f32;
[[location(6), interpolate(linear, sample)]]
x_6_1 : f32;
};
}
[[stage(fragment)]]
fn main() -> main_out {
@ -5192,7 +5192,7 @@ TEST_F(SpvModuleScopeVarParserTest,
field3 : f32;
field4 : f32;
field5 : f32;
};
}
var<private> x_1 : S;
@ -5213,7 +5213,7 @@ struct main_out {
x_1_5 : f32;
[[location(6), interpolate(linear, sample)]]
x_1_6 : f32;
};
}
[[stage(fragment)]]
fn main() -> main_out {

View File

@ -56,7 +56,7 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) {
EXPECT_THAT(test::ToString(p->program()), HasSubstr(R"(struct S {
field0 : u32;
field1 : u32;
};
}
struct S_1 {
field0 : u32;

View File

@ -349,7 +349,7 @@ void ParserImpl::translation_unit() {
// | global_variable_decl SEMICLON
// | global_constant_decl SEMICOLON
// | type_alias SEMICOLON
// | struct_decl SEMICOLON
// | struct_decl
// | function_decl
Expect<bool> ParserImpl::expect_global_decl() {
if (match(Token::Type::kSemicolon) || match(Token::Type::kEOF))
@ -404,9 +404,6 @@ Expect<bool> ParserImpl::expect_global_decl() {
return Failure::kErrored;
if (str.matched) {
if (!expect("struct declaration", Token::Type::kSemicolon))
return Failure::kErrored;
builder_.AST().AddTypeDecl(str.value);
return true;
}

View File

@ -636,13 +636,6 @@ TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingIdentifier) {
" ^\n");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingSemicolon) {
EXPECT("struct S {}",
"test.wgsl:1:12 error: expected ';' for struct declaration\n"
"struct S {}\n"
" ^\n");
}
TEST_F(ParserImplErrorTest, GlobalDeclStructDeclMissingLBrace) {
EXPECT("struct S };",
"test.wgsl:1:10 error: expected '{' for struct declaration\n"

View File

@ -93,7 +93,7 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) {
TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) {
auto p = parser(R"(struct A {
a : f32;
};
}
type B = A;)");
p->expect_global_decl();
p->expect_global_decl();
@ -150,7 +150,7 @@ TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) {
}
TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) {
auto p = parser("struct A { b: i32; c: f32;};");
auto p = parser("struct A { b: i32; c: f32;}");
p->expect_global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
@ -167,7 +167,7 @@ TEST_F(ParserImplTest, GlobalDecl_ParsesStruct) {
}
TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) {
auto p = parser("struct A { data: [[stride(4)]] array<f32>; };");
auto p = parser("struct A { data: [[stride(4)]] array<f32>; }");
p->expect_global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
@ -195,7 +195,7 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithStride) {
// TODO(crbug.com/tint/1324): DEPRECATED: Remove when [[block]] is removed.
TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) {
auto p = parser("[[block]] struct A { data: f32; };");
auto p = parser("[[block]] struct A { data: f32; }");
p->expect_global_decl();
ASSERT_FALSE(p->has_error()) << p->error();
@ -212,19 +212,12 @@ TEST_F(ParserImplTest, GlobalDecl_Struct_WithDecoration) {
}
TEST_F(ParserImplTest, GlobalDecl_Struct_Invalid) {
auto p = parser("A {};");
auto p = parser("A {}");
p->expect_global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:1: unexpected token");
}
TEST_F(ParserImplTest, GlobalDecl_StructMissing_Semi) {
auto p = parser("struct A {}");
p->expect_global_decl();
ASSERT_TRUE(p->has_error());
EXPECT_EQ(p->error(), "1:12: expected ';' for struct declaration");
}
} // namespace
} // namespace wgsl
} // namespace reader

View File

@ -115,7 +115,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_InvalidValue) {
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_Empty) {
auto p = parser(R"(
struct S { a : i32; b : f32; };
struct S { a : i32; b : f32; }
S()
)");
@ -139,7 +139,7 @@ TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_Empty) {
TEST_F(ParserImplTest, PrimaryExpression_TypeDecl_StructConstructor_NotEmpty) {
auto p = parser(R"(
struct S { a : i32; b : f32; };
struct S { a : i32; b : f32; }
S(1u, 2.0)
)");

View File

@ -37,6 +37,27 @@ fn main() -> [[location(0)]] vec4<f32> {
ASSERT_EQ(1u, program.AST().Functions().size());
}
TEST_F(ParserImplTest, Parses_ExtraSemicolons) {
auto p = parser(R"(
;
struct S {
a : f32;
};;
;
fn foo() -> S {
;
return S();;;
;
};;
;
)");
ASSERT_TRUE(p->Parse()) << p->error();
Program program = p->program();
ASSERT_EQ(1u, program.AST().Functions().size());
ASSERT_EQ(1u, program.AST().TypeDecls().size());
}
TEST_F(ParserImplTest, HandlesError) {
auto p = parser(R"(
fn main() -> { // missing return type

View File

@ -38,7 +38,7 @@ TEST_F(AddSpirvBlockDecorationTest, Noop_UsedForPrivateVar) {
auto* src = R"(
struct S {
f : f32;
};
}
var<private> p : S;
@ -59,7 +59,7 @@ TEST_F(AddSpirvBlockDecorationTest, Noop_UsedForShaderIO) {
struct S {
[[location(0)]]
f : f32;
};
}
[[stage(fragment)]]
fn main() -> S {
@ -87,7 +87,7 @@ fn main() {
[[internal(spirv_block)]]
struct u_block {
inner : f32;
};
}
[[group(0), binding(0)]] var<uniform> u : u_block;
@ -116,7 +116,7 @@ fn main() {
[[internal(spirv_block)]]
struct u_block {
inner : array<vec4<f32>, 4u>;
};
}
[[group(0), binding(0)]] var<uniform> u : u_block;
@ -149,7 +149,7 @@ type Numbers = array<vec4<f32>, 4u>;
[[internal(spirv_block)]]
struct u_block {
inner : array<vec4<f32>, 4u>;
};
}
[[group(0), binding(0)]] var<uniform> u : u_block;
@ -182,7 +182,7 @@ fn main() {
[[internal(spirv_block)]]
struct S {
f : f32;
};
}
[[group(0), binding(0)]] var<uniform> u : S;
@ -218,12 +218,12 @@ fn main() {
auto* expect = R"(
struct Inner {
f : f32;
};
}
[[internal(spirv_block)]]
struct Outer {
i : Inner;
};
}
[[group(0), binding(0)]] var<uniform> u : Outer;
@ -263,19 +263,19 @@ fn main() {
auto* expect = R"(
struct Inner {
f : f32;
};
}
[[internal(spirv_block)]]
struct Outer {
i : Inner;
};
}
[[group(0), binding(0)]] var<uniform> u0 : Outer;
[[internal(spirv_block)]]
struct u1_block {
inner : Inner;
};
}
[[group(0), binding(1)]] var<uniform> u1 : u1_block;
@ -315,18 +315,18 @@ fn main() {
auto* expect = R"(
struct Inner {
f : f32;
};
}
struct Outer {
i : Inner;
};
}
var<private> p : Outer;
[[internal(spirv_block)]]
struct u_block {
inner : Inner;
};
}
[[group(0), binding(1)]] var<uniform> u : u_block;
@ -371,19 +371,19 @@ fn main() {
auto* expect = R"(
struct Inner {
f : f32;
};
}
[[internal(spirv_block)]]
struct S {
i : Inner;
};
}
[[group(0), binding(0)]] var<uniform> u0 : S;
[[internal(spirv_block)]]
struct u1_block {
inner : Inner;
};
}
[[group(0), binding(1)]] var<uniform> u1 : u1_block;
@ -420,12 +420,12 @@ fn main() {
auto* expect = R"(
struct S {
f : f32;
};
}
[[internal(spirv_block)]]
struct u_block {
inner : S;
};
}
[[group(0), binding(0)]] var<uniform> u : u_block;
@ -463,12 +463,12 @@ fn main() {
auto* expect = R"(
struct S {
f : f32;
};
}
[[internal(spirv_block)]]
struct u0_block {
inner : S;
};
}
[[group(0), binding(0)]] var<uniform> u0 : u0_block;
@ -516,14 +516,14 @@ fn main() {
auto* expect = R"(
struct Inner {
f : f32;
};
}
type MyInner = Inner;
[[internal(spirv_block)]]
struct Outer {
i : MyInner;
};
}
type MyOuter = Outer;
@ -532,7 +532,7 @@ type MyOuter = Outer;
[[internal(spirv_block)]]
struct u1_block {
inner : Inner;
};
}
[[group(0), binding(1)]] var<uniform> u1 : u1_block;

View File

@ -63,7 +63,7 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 1u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -106,14 +106,14 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 1u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
struct SB {
x : i32;
arr : array<i32>;
};
}
[[group(0), binding(0)]] var<storage, read> sb : SB;
@ -149,7 +149,7 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 1u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -193,7 +193,7 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 1u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -201,7 +201,7 @@ struct SB {
x : i32;
y : f32;
arr : [[stride(64)]] array<i32>;
};
}
[[group(0), binding(0)]] var<storage, read> sb : SB;
@ -259,24 +259,24 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 2u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
struct SB1 {
x : i32;
arr1 : array<i32>;
};
}
struct SB2 {
x : i32;
arr2 : array<vec4<f32>>;
};
}
struct SB4 {
x : i32;
arr4 : array<vec4<f32>>;
};
}
[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
@ -348,24 +348,24 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 1u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
struct SB1 {
x : i32;
arr1 : array<i32>;
};
}
struct SB2 {
x : i32;
arr2 : array<vec4<f32>>;
};
}
struct SB4 {
x : i32;
arr4 : array<vec4<f32>>;
};
}
[[group(0), binding(2)]] var<storage, read> sb1 : SB1;
@ -407,7 +407,7 @@ TEST_F(ArrayLengthFromUniformTest, NoArrayLengthCalls) {
struct SB {
x : i32;
arr : array<i32>;
};
}
[[group(0), binding(0)]] var<storage, read> sb : SB;
@ -457,19 +457,19 @@ fn main() {
auto* expect = R"(
struct tint_symbol {
buffer_size : array<vec4<u32>, 1u>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_1 : tint_symbol;
struct SB1 {
x : i32;
arr1 : array<i32>;
};
}
struct SB2 {
x : i32;
arr2 : array<vec4<f32>>;
};
}
[[group(0), binding(2)]] var<storage, read> sb1 : SB1;

View File

@ -28,7 +28,7 @@ TEST_F(BindingRemapperTest, NoRemappings) {
auto* src = R"(
struct S {
a : f32;
};
}
[[group(2), binding(1)]] var<storage, read> a : S;
@ -67,7 +67,7 @@ fn f() {
auto* expect = R"(
struct S {
a : f32;
};
}
[[group(1), binding(2)]] var<storage, read> a : S;
@ -111,7 +111,7 @@ fn f() {
auto* expect = R"(
struct S {
a : f32;
};
}
[[group(2), binding(1)]] var<storage, write> a : S;
@ -215,7 +215,7 @@ fn f() {
auto* expect = R"(
struct S {
a : f32;
};
}
[[group(4), binding(5)]] var<storage, write> a : S;
@ -264,7 +264,7 @@ fn f() {
auto* expect = R"(
struct S {
i : i32;
};
}
[[internal(disable_validation__binding_point_collision), group(1), binding(1)]] var<storage, read> a : S;
@ -321,7 +321,7 @@ fn f2() {
auto* expect = R"(
struct S {
i : i32;
};
}
[[group(1), binding(1)]] var<storage, read> a : S;

View File

@ -85,7 +85,7 @@ fn main() {
struct SB {
x : i32;
arr : array<i32>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
@ -161,7 +161,7 @@ fn main() {
struct SB {
x : i32;
arr : array<i32>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
@ -235,7 +235,7 @@ struct SB {
x : i32;
y : f32;
arr : [[stride(64)]] array<i32>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
@ -281,7 +281,7 @@ fn main() {
struct SB {
x : i32;
arr : array<i32>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)
@ -345,7 +345,7 @@ fn tint_symbol_6([[internal(disable_validation__ignore_constructible_function_pa
struct SB1 {
x : i32;
arr1 : array<i32>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB1, result : ptr<function, u32>)
@ -353,7 +353,7 @@ fn tint_symbol([[internal(disable_validation__ignore_constructible_function_para
struct SB2 {
x : i32;
arr2 : array<vec4<f32>>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol_3([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB2, result : ptr<function, u32>)
@ -412,7 +412,7 @@ fn main() {
struct SB {
x : i32;
arr : array<i32>;
};
}
[[internal(intrinsic_buffer_size)]]
fn tint_symbol([[internal(disable_validation__ignore_constructible_function_parameter)]] buffer : SB, result : ptr<function, u32>)

View File

@ -121,7 +121,7 @@ struct tint_symbol_1 {
loc1 : f32;
[[location(2)]]
loc2 : vec4<u32>;
};
}
fn frag_main_inner(loc1 : f32, loc2 : vec4<u32>, coord : vec4<f32>) {
var col : f32 = (coord.x * loc1);
@ -159,7 +159,7 @@ struct tint_symbol_1 {
loc2 : vec4<u32>;
[[builtin(position)]]
coord : vec4<f32>;
};
}
fn frag_main_inner(loc1 : f32, loc2 : vec4<u32>, coord : vec4<f32>) {
var col : f32 = (coord.x * loc1);
@ -195,7 +195,7 @@ type myf32 = f32;
struct tint_symbol_1 {
[[location(1)]]
loc1 : f32;
};
}
fn frag_main_inner(loc1 : myf32) {
var x : myf32 = loc1;
@ -244,12 +244,12 @@ fn frag_main([[location(0)]] loc0 : f32,
struct FragBuiltins {
coord : vec4<f32>;
};
}
struct FragLocations {
loc1 : f32;
loc2 : vec4<u32>;
};
}
fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltins) {
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
@ -290,12 +290,12 @@ fn frag_main([[location(0)]] loc0 : f32,
auto* expect = R"(
struct FragBuiltins {
coord : vec4<f32>;
};
}
struct FragLocations {
loc1 : f32;
loc2 : vec4<u32>;
};
}
struct tint_symbol_1 {
[[location(0)]]
@ -304,7 +304,7 @@ struct tint_symbol_1 {
loc1 : f32;
[[location(2)]]
loc2 : vec4<u32>;
};
}
fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltins) {
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
@ -345,12 +345,12 @@ fn frag_main([[location(0)]] loc0 : f32,
auto* expect = R"(
struct FragBuiltins {
coord : vec4<f32>;
};
}
struct FragLocations {
loc1 : f32;
loc2 : vec4<u32>;
};
}
struct tint_symbol_1 {
[[location(0)]]
@ -361,7 +361,7 @@ struct tint_symbol_1 {
loc2 : vec4<u32>;
[[builtin(position)]]
coord : vec4<f32>;
};
}
fn frag_main_inner(loc0 : f32, locations : FragLocations, builtins : FragBuiltins) {
var col : f32 = ((builtins.coord.x * locations.loc1) + loc0);
@ -423,7 +423,7 @@ fn frag_main() -> [[builtin(frag_depth)]] f32 {
struct tint_symbol {
[[builtin(frag_depth)]]
value : f32;
};
}
fn frag_main_inner() -> f32 {
return 1.0;
@ -458,7 +458,7 @@ fn frag_main() -> [[builtin(frag_depth)]] f32 {
struct tint_symbol {
[[builtin(frag_depth)]]
value : f32;
};
}
fn frag_main_inner() -> f32 {
return 1.0;
@ -510,7 +510,7 @@ struct FragOutput {
color : vec4<f32>;
depth : f32;
mask : u32;
};
}
fn frag_main_inner() -> FragOutput {
var output : FragOutput;
@ -560,7 +560,7 @@ struct FragOutput {
color : vec4<f32>;
depth : f32;
mask : u32;
};
}
struct tint_symbol {
[[location(0)]]
@ -569,7 +569,7 @@ struct tint_symbol {
depth : f32;
[[builtin(sample_mask)]]
mask : u32;
};
}
fn frag_main_inner() -> FragOutput {
var output : FragOutput;
@ -621,7 +621,7 @@ struct FragOutput {
color : vec4<f32>;
depth : f32;
mask : u32;
};
}
struct tint_symbol {
[[location(0)]]
@ -630,7 +630,7 @@ struct tint_symbol {
depth : f32;
[[builtin(sample_mask)]]
mask : u32;
};
}
fn frag_main_inner() -> FragOutput {
var output : FragOutput;
@ -694,7 +694,7 @@ fn frag_main2(inputs : FragmentInput) {
struct FragmentInput {
value : f32;
mul : f32;
};
}
fn foo(x : FragmentInput) -> f32 {
return (x.value * x.mul);
@ -754,7 +754,7 @@ fn frag_main2(inputs : FragmentInput) {
struct FragmentInput {
value : f32;
mul : f32;
};
}
fn foo(x : FragmentInput) -> f32 {
return (x.value * x.mul);
@ -765,7 +765,7 @@ struct tint_symbol_1 {
value : f32;
[[location(1)]]
mul : f32;
};
}
fn frag_main1_inner(inputs : FragmentInput) {
var x : f32 = foo(inputs);
@ -781,7 +781,7 @@ struct tint_symbol_3 {
value : f32;
[[location(1)]]
mul : f32;
};
}
fn frag_main2_inner(inputs : FragmentInput) {
var x : f32 = foo(inputs);
@ -828,7 +828,7 @@ fn frag_main2(inputs : FragmentInput) {
struct FragmentInput {
value : f32;
mul : f32;
};
}
fn foo(x : FragmentInput) -> f32 {
return (x.value * x.mul);
@ -839,7 +839,7 @@ struct tint_symbol_1 {
value : f32;
[[location(1)]]
mul : f32;
};
}
fn frag_main1_inner(inputs : FragmentInput) {
var x : f32 = foo(inputs);
@ -855,7 +855,7 @@ struct tint_symbol_3 {
value : f32;
[[location(1)]]
mul : f32;
};
}
fn frag_main2_inner(inputs : FragmentInput) {
var x : f32 = foo(inputs);
@ -904,7 +904,7 @@ fn frag_main1(inputs : FragmentInput) {
struct FragmentInput {
col1 : f32;
col2 : f32;
};
}
var<private> global_inputs : FragmentInput;
@ -921,7 +921,7 @@ struct tint_symbol_1 {
col1 : f32;
[[location(1)]]
col2 : f32;
};
}
fn frag_main1_inner(inputs : FragmentInput) {
global_inputs = inputs;
@ -978,12 +978,12 @@ type myf32 = f32;
struct FragmentInput {
col1 : myf32;
col2 : myf32;
};
}
struct FragmentOutput {
col1 : myf32;
col2 : myf32;
};
}
type MyFragmentInput = FragmentInput;
@ -998,14 +998,14 @@ struct tint_symbol_1 {
col1 : f32;
[[location(1)]]
col2 : f32;
};
}
struct tint_symbol_2 {
[[location(0)]]
col1 : f32;
[[location(1)]]
col2 : f32;
};
}
fn frag_main_inner(inputs : MyFragmentInput) -> MyFragmentOutput {
var x : myf32 = foo(inputs);
@ -1062,12 +1062,12 @@ struct VertexOut {
loc1 : f32;
loc2 : f32;
loc3 : f32;
};
}
struct FragmentIn {
loc1 : f32;
loc2 : f32;
};
}
struct tint_symbol {
[[location(1), interpolate(flat)]]
@ -1078,7 +1078,7 @@ struct tint_symbol {
loc3 : f32;
[[builtin(position)]]
pos : vec4<f32>;
};
}
fn vert_main_inner() -> VertexOut {
return VertexOut();
@ -1102,7 +1102,7 @@ struct tint_symbol_2 {
loc2 : f32;
[[location(3), interpolate(perspective, centroid)]]
loc3 : f32;
};
}
fn frag_main_inner(inputs : FragmentIn, loc3 : f32) {
let x = ((inputs.loc1 + inputs.loc2) + loc3);
@ -1200,7 +1200,7 @@ struct VertexIn {
u : u32;
vi : vec4<i32>;
vu : vec4<u32>;
};
}
struct VertexOut {
i : i32;
@ -1208,14 +1208,14 @@ struct VertexOut {
vi : vec4<i32>;
vu : vec4<u32>;
pos : vec4<f32>;
};
}
struct FragmentInterface {
i : i32;
u : u32;
vi : vec4<i32>;
vu : vec4<u32>;
};
}
fn vert_main_inner(in : VertexIn) -> VertexOut {
return VertexOut(in.i, in.u, in.vi, in.vu, vec4<f32>());
@ -1273,12 +1273,12 @@ fn main2() -> [[builtin(position), invariant]] vec4<f32> {
auto* expect = R"(
struct VertexOut {
pos : vec4<f32>;
};
}
struct tint_symbol {
[[builtin(position), invariant]]
pos : vec4<f32>;
};
}
fn main1_inner() -> VertexOut {
return VertexOut();
@ -1295,7 +1295,7 @@ fn main1() -> tint_symbol {
struct tint_symbol_1 {
[[builtin(position), invariant]]
value : vec4<f32>;
};
}
fn main2_inner() -> vec4<f32> {
return vec4<f32>();
@ -1344,12 +1344,12 @@ struct FragmentInput {
coord : vec4<f32>;
[[align(128)]]
loc0 : f32;
};
}
struct FragmentOutput {
[[size(16)]]
value : f32;
};
}
struct tint_symbol_1 {
[[location(0), interpolate(linear, sample)]]
@ -1358,12 +1358,12 @@ struct tint_symbol_1 {
value : f32;
[[builtin(position)]]
coord : vec4<f32>;
};
}
struct tint_symbol_2 {
[[location(1), interpolate(flat)]]
value : f32;
};
}
fn frag_main_inner(inputs : FragmentInput) -> FragmentOutput {
return FragmentOutput(((inputs.coord.x * inputs.value) + inputs.loc0));
@ -1422,13 +1422,13 @@ struct VertexOutput {
d : u32;
a : f32;
c : i32;
};
}
struct FragmentInputExtra {
d : u32;
pos : vec4<f32>;
a : f32;
};
}
struct tint_symbol {
[[location(0)]]
@ -1441,7 +1441,7 @@ struct tint_symbol {
d : u32;
[[builtin(position)]]
pos : vec4<f32>;
};
}
fn vert_main_inner() -> VertexOutput {
return VertexOutput();
@ -1472,7 +1472,7 @@ struct tint_symbol_2 {
pos : vec4<f32>;
[[builtin(front_facing)]]
ff : bool;
};
}
fn frag_main_inner(ff : bool, c : i32, inputs : FragmentInputExtra, b : u32) {
}
@ -1502,7 +1502,7 @@ fn tint_symbol_1([[location(0)]] col : f32) {
struct tint_symbol_2 {
[[location(0)]]
col : f32;
};
}
fn tint_symbol_1_inner(col : f32) {
}
@ -1532,7 +1532,7 @@ fn frag_main() {
struct tint_symbol {
[[builtin(sample_mask)]]
fixed_sample_mask : u32;
};
}
fn frag_main_inner() {
}
@ -1566,7 +1566,7 @@ fn frag_main() {
struct tint_symbol {
[[builtin(sample_mask)]]
fixed_sample_mask : u32;
};
}
fn frag_main_inner() {
return;
@ -1601,7 +1601,7 @@ fn frag_main() -> [[builtin(sample_mask)]] u32 {
struct tint_symbol {
[[builtin(sample_mask)]]
value : u32;
};
}
fn frag_main_inner() -> u32 {
return 7u;
@ -1638,7 +1638,7 @@ struct tint_symbol {
value : f32;
[[builtin(sample_mask)]]
fixed_sample_mask : u32;
};
}
fn frag_main_inner() -> f32 {
return 1.0;
@ -1681,7 +1681,7 @@ struct Output {
depth : f32;
mask : u32;
value : f32;
};
}
struct tint_symbol {
[[location(0)]]
@ -1690,7 +1690,7 @@ struct tint_symbol {
depth : f32;
[[builtin(sample_mask)]]
mask : u32;
};
}
fn frag_main_inner() -> Output {
return Output(0.5, 7u, 1.0);
@ -1733,7 +1733,7 @@ fn frag_main() -> Output {
struct Output {
depth : f32;
value : f32;
};
}
struct tint_symbol {
[[location(0)]]
@ -1742,7 +1742,7 @@ struct tint_symbol {
depth : f32;
[[builtin(sample_mask)]]
fixed_sample_mask : u32;
};
}
fn frag_main_inner() -> Output {
return Output(0.5, 1.0);
@ -1793,7 +1793,7 @@ fn comp_main1() {
struct tint_symbol {
[[builtin(sample_mask)]]
value : u32;
};
}
fn frag_main1_inner() -> u32 {
return 7u;
@ -1812,7 +1812,7 @@ struct tint_symbol_1 {
value : f32;
[[builtin(sample_mask)]]
fixed_sample_mask : u32;
};
}
fn frag_main2_inner() -> f32 {
return 1.0;
@ -1830,7 +1830,7 @@ fn frag_main2() -> tint_symbol_1 {
struct tint_symbol_2 {
[[builtin(position)]]
value : vec4<f32>;
};
}
fn vert_main1_inner() -> vec4<f32> {
return vec4<f32>();
@ -1874,7 +1874,7 @@ fn frag_main() -> FragOut {
struct FragOut {
fixed_sample_mask : vec4<f32>;
fixed_sample_mask_1 : vec4<f32>;
};
}
struct tint_symbol {
[[location(0)]]
@ -1883,7 +1883,7 @@ struct tint_symbol {
fixed_sample_mask_1 : vec4<f32>;
[[builtin(sample_mask)]]
fixed_sample_mask_2 : u32;
};
}
fn frag_main_inner() -> FragOut {
return FragOut();
@ -1956,7 +1956,7 @@ struct tint_symbol {
value : vec4<f32>;
[[builtin(pointsize)]]
vertex_point_size : f32;
};
}
fn vert_main_inner() -> vec4<f32> {
return vec4<f32>();
@ -1999,7 +1999,7 @@ fn vert_main() -> VertOut {
struct VertOut {
pos : vec4<f32>;
};
}
fn vert_main_inner() -> VertOut {
return VertOut();
@ -2036,14 +2036,14 @@ fn vert_main() -> VertOut {
auto* expect = R"(
struct VertOut {
pos : vec4<f32>;
};
}
struct tint_symbol {
[[builtin(position)]]
pos : vec4<f32>;
[[builtin(pointsize)]]
vertex_point_size : f32;
};
}
fn vert_main_inner() -> VertOut {
return VertOut();
@ -2112,16 +2112,16 @@ var<private> vertex_point_size_2 : f32;
struct VertIn1 {
collide : f32;
};
}
struct VertIn2 {
collide : f32;
};
}
struct VertOut {
vertex_point_size : f32;
vertex_point_size_1 : vec4<f32>;
};
}
fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
let x = (collide.collide + collide_1.collide);
@ -2170,23 +2170,23 @@ fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
auto* expect = R"(
struct VertIn1 {
collide : f32;
};
}
struct VertIn2 {
collide : f32;
};
}
struct VertOut {
vertex_point_size : vec4<f32>;
vertex_point_size_1 : vec4<f32>;
};
}
struct tint_symbol_1 {
[[location(0)]]
collide : f32;
[[location(1)]]
collide_2 : f32;
};
}
struct tint_symbol_2 {
[[location(0)]]
@ -2195,7 +2195,7 @@ struct tint_symbol_2 {
vertex_point_size_1 : vec4<f32>;
[[builtin(pointsize)]]
vertex_point_size_2 : f32;
};
}
fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
let x = (collide.collide + collide_1.collide);
@ -2246,23 +2246,23 @@ fn vert_main(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
auto* expect = R"(
struct VertIn1 {
collide : f32;
};
}
struct VertIn2 {
collide : f32;
};
}
struct VertOut {
vertex_point_size : vec4<f32>;
vertex_point_size_1 : vec4<f32>;
};
}
struct tint_symbol_1 {
[[location(0)]]
collide : f32;
[[location(1)]]
collide_2 : f32;
};
}
struct tint_symbol_2 {
[[location(0)]]
@ -2271,7 +2271,7 @@ struct tint_symbol_2 {
vertex_point_size_1 : vec4<f32>;
[[builtin(pointsize)]]
vertex_point_size_2 : f32;
};
}
fn vert_main_inner(collide : VertIn1, collide_1 : VertIn2) -> VertOut {
let x = (collide.collide + collide_1.collide);

View File

@ -102,7 +102,7 @@ struct SB {
t : mat4x3<f32>;
u : mat4x4<f32>;
v : array<vec3<f32>, 2>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -298,7 +298,7 @@ struct UB {
t : mat4x3<f32>;
u : mat4x4<f32>;
v : array<vec3<f32>, 2>;
};
}
[[group(0), binding(0)]] var<uniform> ub : UB;
@ -494,7 +494,7 @@ struct SB {
t : mat4x3<f32>;
u : mat4x4<f32>;
v : array<vec3<f32>, 2>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -686,7 +686,7 @@ struct SB {
t : mat4x3<f32>;
u : mat4x4<f32>;
v : array<vec3<f32>, 2>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -844,7 +844,7 @@ struct SB {
t : mat4x3<f32>;
u : mat4x4<f32>;
v : array<vec3<f32>, 2>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -1021,19 +1021,19 @@ struct S1 {
a : i32;
b : vec3<f32>;
c : i32;
};
}
struct S2 {
a : i32;
b : [[stride(32)]] array<S1, 3>;
c : i32;
};
}
struct SB {
[[size(128)]]
a : i32;
b : [[stride(256)]] array<S2>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -1087,19 +1087,19 @@ struct S1 {
a : i32;
b : vec3<f32>;
c : i32;
};
}
struct S2 {
a : i32;
b : [[stride(32)]] array<S1, 3>;
c : i32;
};
}
struct SB {
[[size(128)]]
a : i32;
b : [[stride(256)]] array<S2>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -1164,7 +1164,7 @@ struct S1 {
a : i32;
b : vec3<f32>;
c : i32;
};
}
type A1 = S1;
@ -1174,7 +1174,7 @@ struct S2 {
a : i32;
b : A1_Array;
c : i32;
};
}
type A2 = S2;
@ -1184,7 +1184,7 @@ struct SB {
[[size(128)]]
a : i32;
b : A2_Array;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -1248,7 +1248,7 @@ struct SB {
padding : vec4<f32>;
a : atomic<i32>;
b : atomic<u32>;
};
}
[[group(0), binding(0)]] var<storage, read_write> sb : SB;
@ -1356,7 +1356,7 @@ struct S {
padding : vec4<f32>;
a : atomic<i32>;
b : atomic<u32>;
};
}
var<workgroup> w : S;

View File

@ -91,7 +91,7 @@ struct S {
[[size(16)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<uniform> s : S;
@ -152,7 +152,7 @@ struct S {
[[size(16)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<uniform> s : S;
@ -210,7 +210,7 @@ struct S {
padding : u32;
[[stride(8), internal(disable_validation__ignore_stride)]]
m : mat2x2<f32>;
};
}
[[group(0), binding(0)]] var<uniform> s : S;
@ -267,7 +267,7 @@ struct S {
[[size(8)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<storage, read_write> s : S;
@ -328,7 +328,7 @@ struct S {
[[size(16)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<storage, read_write> s : S;
@ -386,7 +386,7 @@ struct S {
[[size(8)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<storage, read_write> s : S;
@ -447,7 +447,7 @@ struct S {
[[size(8)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<storage, read_write> s : S;
@ -519,7 +519,7 @@ struct S {
[[size(8)]]
padding : u32;
m : [[stride(32)]] array<vec2<f32>, 2u>;
};
}
[[group(0), binding(0)]] var<storage, read_write> s : S;
@ -588,7 +588,7 @@ struct S {
padding : u32;
[[stride(32), internal(disable_validation__ignore_stride)]]
m : mat2x2<f32>;
};
}
var<private> s : S;
@ -646,7 +646,7 @@ struct S {
padding : u32;
[[stride(32), internal(disable_validation__ignore_stride)]]
m : mat2x2<f32>;
};
}
var<private> s : S;

View File

@ -61,7 +61,7 @@ fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4
auto* expect = R"(
struct tint_symbol {
first_vertex_index : u32;
};
}
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -107,7 +107,7 @@ fn entry([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]] ve
auto* expect = R"(
struct tint_symbol {
first_instance_index : u32;
};
}
[[binding(1), group(7)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -159,7 +159,7 @@ fn entry(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
struct tint_symbol {
first_vertex_index : u32;
first_instance_index : u32;
};
}
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -172,7 +172,7 @@ struct Inputs {
instance_idx : u32;
[[builtin(vertex_index)]]
vert_idx : u32;
};
}
[[stage(vertex)]]
fn entry(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
@ -216,7 +216,7 @@ fn entry([[builtin(vertex_index)]] vert_idx : u32) -> [[builtin(position)]] vec4
auto* expect = R"(
struct tint_symbol {
first_vertex_index : u32;
};
}
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;
@ -279,7 +279,7 @@ fn entry_c([[builtin(instance_index)]] inst_idx : u32) -> [[builtin(position)]]
struct tint_symbol {
first_vertex_index : u32;
first_instance_index : u32;
};
}
[[binding(1), group(2)]] var<uniform> tint_symbol_1 : tint_symbol;

View File

@ -70,15 +70,15 @@ fn main() {
[[block]]
struct Uniforms {
i : u32;
};
}
struct InnerS {
v : i32;
};
}
struct OuterS {
a1 : array<InnerS, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -132,19 +132,19 @@ fn main() {
[[block]]
struct Uniforms {
i : u32;
};
}
struct InnerS {
v : i32;
};
}
struct S1 {
a : array<InnerS, 8>;
};
}
struct OuterS {
s2 : S1;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -196,15 +196,15 @@ fn main() {
struct Uniforms {
i : u32;
j : u32;
};
}
struct InnerS {
v : i32;
};
}
struct OuterS {
a1 : array<array<InnerS, 8>, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -258,19 +258,19 @@ fn main() {
[[block]]
struct Uniforms {
i : u32;
};
}
struct InnerS {
v : i32;
};
}
struct S1 {
s2 : InnerS;
};
}
struct OuterS {
a1 : array<S1, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -326,19 +326,19 @@ fn main() {
struct Uniforms {
i : u32;
j : u32;
};
}
struct InnerS {
v : i32;
};
}
struct S1 {
a2 : array<InnerS, 8>;
};
}
struct OuterS {
a1 : array<S1, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -403,19 +403,19 @@ fn main() {
struct Uniforms {
i : u32;
j : u32;
};
}
struct InnerS {
v : i32;
};
}
struct S1 {
a2 : array<InnerS, 8>;
};
}
struct OuterS {
a1 : array<S1, 8>;
};
}
var<private> nextIndex : u32;
@ -476,15 +476,15 @@ fn main() {
[[block]]
struct Uniforms {
i : u32;
};
}
struct InnerS {
v : i32;
};
}
struct OuterS {
a1 : array<InnerS, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -544,15 +544,15 @@ fn main() {
[[block]]
struct Uniforms {
i : u32;
};
}
struct InnerS {
v : i32;
};
}
struct OuterS {
a1 : array<InnerS, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;
@ -584,12 +584,12 @@ TEST_F(LocalizeStructArrayAssignmentTest, VectorAssignment) {
[[block]]
struct Uniforms {
i : u32;
};
}
[[block]]
struct OuterS {
a1 : array<u32, 8>;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -218,7 +218,7 @@ fn main() {
auto* expect = R"(
struct S {
a : f32;
};
}
[[stage(compute), workgroup_size(1)]]
fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<uniform, S>, [[group(0), binding(1), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol_1 : ptr<storage, S>) {
@ -246,7 +246,7 @@ fn main() {
auto* expect = R"(
struct tint_symbol_1 {
arr : array<f32>;
};
}
[[stage(compute), workgroup_size(1)]]
fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<storage, tint_symbol_1>) {
@ -275,7 +275,7 @@ fn main() {
auto* expect = R"(
struct tint_symbol_1 {
arr : array<f32>;
};
}
type myarray = array<f32>;
@ -308,11 +308,11 @@ fn main() {
auto* expect = R"(
struct S {
f : f32;
};
}
struct tint_symbol_1 {
arr : array<S>;
};
}
[[stage(compute), workgroup_size(1)]]
fn main([[group(0), binding(0), internal(disable_validation__entry_point_parameter), internal(disable_validation__ignore_storage_class)]] tint_symbol : ptr<storage, tint_symbol_1>) {
@ -360,7 +360,7 @@ fn main() {
auto* expect = R"(
struct S {
a : f32;
};
}
fn no_uses() {
}
@ -479,7 +479,7 @@ fn main() {
auto* expect = R"(
struct tint_symbol_2 {
m : mat2x2<f32>;
};
}
[[stage(compute), workgroup_size(1)]]
fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
@ -512,15 +512,15 @@ fn main() {
auto* expect = R"(
struct S1 {
m : mat2x2<f32>;
};
}
struct S2 {
s : S1;
};
}
struct tint_symbol_2 {
m : array<S2, 4u>;
};
}
[[stage(compute), workgroup_size(1)]]
fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr<workgroup, tint_symbol_2>) {
@ -556,12 +556,12 @@ fn main() {
auto* expect = R"(
struct S {
m : mat2x2<f32>;
};
}
struct tint_symbol_3 {
a : S;
b : S;
};
}
[[stage(compute), workgroup_size(1)]]
fn main([[internal(disable_validation__entry_point_parameter)]] tint_symbol_1 : ptr<workgroup, tint_symbol_3>) {
@ -602,7 +602,7 @@ fn main() {
auto* expect = R"(
struct S {
a : f32;
};
}
[[stage(compute), workgroup_size(1)]]
fn main() {

View File

@ -84,7 +84,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
[[group(0), binding(1)]] var ext_tex_plane_1 : texture_2d<f32>;
@ -128,7 +128,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
[[group(0), binding(2)]] var ext_tex_plane_1 : texture_2d<f32>;
@ -181,7 +181,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
[[group(0), binding(1)]] var ext_tex_plane_1 : texture_2d<f32>;
@ -238,7 +238,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
[[group(0), binding(2)]] var ext_tex_plane_1 : texture_2d<f32>;
@ -311,7 +311,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
[[group(0), binding(4)]] var ext_tex_plane_1 : texture_2d<f32>;
@ -393,7 +393,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@ -459,7 +459,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@ -527,7 +527,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {
@ -605,7 +605,7 @@ struct ExternalTextureParams {
ug : f32;
vg : f32;
ub : f32;
};
}
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
if ((params.numPlanes == 1u)) {

View File

@ -68,7 +68,7 @@ fn main([[builtin(num_workgroups)]] num_wgs : vec3<u32>) {
auto* expect = R"(
struct tint_symbol_2 {
num_workgroups : vec3<u32>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_3 : tint_symbol_2;
@ -110,13 +110,13 @@ fn main(in : Builtins) {
auto* expect = R"(
struct tint_symbol_2 {
num_workgroups : vec3<u32>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_3 : tint_symbol_2;
struct Builtins {
num_wgs : vec3<u32>;
};
}
fn main_inner(in : Builtins) {
let groups_x = in.num_wgs.x;
@ -158,7 +158,7 @@ fn main(in : Builtins) {
auto* expect = R"(
struct tint_symbol_2 {
num_workgroups : vec3<u32>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_3 : tint_symbol_2;
@ -166,14 +166,14 @@ struct Builtins {
gid : vec3<u32>;
num_wgs : vec3<u32>;
wgid : vec3<u32>;
};
}
struct tint_symbol_1 {
[[builtin(global_invocation_id)]]
gid : vec3<u32>;
[[builtin(workgroup_id)]]
wgid : vec3<u32>;
};
}
fn main_inner(in : Builtins) {
let groups_x = in.num_wgs.x;
@ -233,19 +233,19 @@ fn main3([[builtin(num_workgroups)]] num_wgs : vec3<u32>) {
auto* expect = R"(
struct tint_symbol_6 {
num_workgroups : vec3<u32>;
};
}
[[group(0), binding(30)]] var<uniform> tint_symbol_7 : tint_symbol_6;
struct Builtins1 {
num_wgs : vec3<u32>;
};
}
struct Builtins2 {
gid : vec3<u32>;
num_wgs : vec3<u32>;
wgid : vec3<u32>;
};
}
fn main1_inner(in : Builtins1) {
let groups_x = in.num_wgs.x;
@ -263,7 +263,7 @@ struct tint_symbol_3 {
gid : vec3<u32>;
[[builtin(workgroup_id)]]
wgid : vec3<u32>;
};
}
fn main2_inner(in : Builtins2) {
let groups_x = in.num_wgs.x;
@ -313,14 +313,14 @@ fn main(in : Builtins) {
struct Builtins {
gid : vec3<u32>;
wgid : vec3<u32>;
};
}
struct tint_symbol_1 {
[[builtin(global_invocation_id)]]
gid : vec3<u32>;
[[builtin(workgroup_id)]]
wgid : vec3<u32>;
};
}
fn main_inner(in : Builtins) {
}

View File

@ -52,7 +52,7 @@ var<private> arr : [[stride(8)]] array<i32, 4>;
struct tint_padded_array_element {
[[size(8)]]
el : i32;
};
}
var<private> arr : array<tint_padded_array_element, 4u>;
)";
@ -72,11 +72,11 @@ struct S {
struct tint_padded_array_element {
[[size(8)]]
el : i32;
};
}
struct S {
rta : array<tint_padded_array_element>;
};
}
)";
auto got = Run<PadArrayElements>(src);
@ -97,7 +97,7 @@ fn f() {
struct tint_padded_array_element {
[[size(16)]]
el : i32;
};
}
fn f() {
var arr : array<tint_padded_array_element, 4u>;
@ -122,7 +122,7 @@ fn f(a : [[stride(12)]] array<i32, 4>) -> i32 {
struct tint_padded_array_element {
[[size(12)]]
el : i32;
};
}
fn f(a : array<tint_padded_array_element, 4u>) -> i32 {
return a[2].el;
@ -175,7 +175,7 @@ fn f() {
struct tint_padded_array_element {
[[size(16)]]
el : i32;
};
}
type Array = array<tint_padded_array_element, 4u>;
@ -207,24 +207,24 @@ struct S {
struct tint_padded_array_element {
[[size(8)]]
el : i32;
};
}
struct tint_padded_array_element_1 {
[[size(8)]]
el : i32;
};
}
struct tint_padded_array_element_2 {
[[size(12)]]
el : i32;
};
}
struct S {
a : array<tint_padded_array_element, 4u>;
b : array<tint_padded_array_element_1, 8u>;
c : array<tint_padded_array_element, 4u>;
d : array<tint_padded_array_element_2, 8u>;
};
}
)";
auto got = Run<PadArrayElements>(src);
@ -244,38 +244,38 @@ struct S {
struct tint_padded_array_element {
[[size(512)]]
el : i32;
};
}
struct tint_padded_array_element_2 {
[[size(32)]]
el : i32;
};
}
struct tint_padded_array_element_1 {
[[size(512)]]
el : array<tint_padded_array_element_2, 4u>;
};
}
struct tint_padded_array_element_5 {
[[size(8)]]
el : i32;
};
}
struct tint_padded_array_element_4 {
[[size(64)]]
el : array<tint_padded_array_element_5, 4u>;
};
}
struct tint_padded_array_element_3 {
[[size(512)]]
el : array<tint_padded_array_element_4, 4u>;
};
}
struct S {
a : array<tint_padded_array_element, 4u>;
b : array<tint_padded_array_element_1, 4u>;
c : array<tint_padded_array_element_3, 4u>;
};
}
)";
auto got = Run<PadArrayElements>(src);
@ -299,38 +299,38 @@ fn f(s : S) -> i32 {
struct tint_padded_array_element {
[[size(512)]]
el : i32;
};
}
struct tint_padded_array_element_2 {
[[size(32)]]
el : i32;
};
}
struct tint_padded_array_element_1 {
[[size(512)]]
el : array<tint_padded_array_element_2, 4u>;
};
}
struct tint_padded_array_element_5 {
[[size(8)]]
el : i32;
};
}
struct tint_padded_array_element_4 {
[[size(64)]]
el : array<tint_padded_array_element_5, 4u>;
};
}
struct tint_padded_array_element_3 {
[[size(512)]]
el : array<tint_padded_array_element_4, 4u>;
};
}
struct S {
a : array<tint_padded_array_element, 4u>;
b : array<tint_padded_array_element_1, 4u>;
c : array<tint_padded_array_element_3, 4u>;
};
}
fn f(s : S) -> i32 {
return ((s.a[2].el + s.b[1].el[2].el) + s.c[3].el[1].el[2].el);
@ -365,7 +365,7 @@ type T0 = i32;
struct tint_padded_array_element {
[[size(8)]]
el : i32;
};
}
type T1 = array<tint_padded_array_element, 1u>;
@ -374,7 +374,7 @@ type T2 = i32;
struct tint_padded_array_element_1 {
[[size(8)]]
el : i32;
};
}
fn f1(a : array<tint_padded_array_element_1, 2u>) {
}
@ -384,7 +384,7 @@ type T3 = i32;
struct tint_padded_array_element_2 {
[[size(8)]]
el : i32;
};
}
fn f2() {
var v : array<tint_padded_array_element_2, 3u>;

View File

@ -67,7 +67,7 @@ struct S {
a : i32;
b : f32;
c : vec3<f32>;
};
}
fn f() {
let tint_symbol = S(1, 2.0, vec3<f32>());
@ -126,7 +126,7 @@ struct S {
a : i32;
b : f32;
c : vec3<f32>;
};
}
fn f() {
var insert_after = 1;
@ -288,17 +288,17 @@ fn f() {
auto* expect = R"(
struct S1 {
a : i32;
};
}
struct S2 {
a : i32;
b : S1;
c : i32;
};
}
struct S3 {
a : S2;
};
}
fn f() {
let tint_symbol = S1(2);
@ -331,11 +331,11 @@ fn f() {
auto* expect = R"(
struct S1 {
a : i32;
};
}
struct S2 {
a : array<S1, 3u>;
};
}
fn f() {
let tint_symbol = S1(1);
@ -358,7 +358,7 @@ struct S {
a : i32;
b : f32;
c : i32;
};
}
fn f() {
var local_arr = array<f32, 4u>(0.0, 1.0, 2.0, 3.0);

View File

@ -204,7 +204,7 @@ fn f() {
auto* expect = R"(
struct S {
arr : array<i32>;
};
}
[[group(0), binding(0)]] var<storage, read_write> s : S;

View File

@ -630,7 +630,7 @@ fn f() {
struct S {
a : f32;
b : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> s : S;
@ -794,7 +794,7 @@ fn f() {
struct S {
a : f32;
b : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> s : S;
@ -874,7 +874,7 @@ TEST_F(RobustnessTest, OmitNone) {
struct S {
a : array<f32, 4>;
b : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> s : S;
@ -882,7 +882,7 @@ type UArr = [[stride(16)]] array<f32, 4>;
struct U {
a : UArr;
};
}
[[group(1), binding(0)]] var<uniform> u : U;
@ -937,7 +937,7 @@ TEST_F(RobustnessTest, OmitStorage) {
struct S {
a : array<f32, 4>;
b : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> s : S;
@ -945,7 +945,7 @@ type UArr = [[stride(16)]] array<f32, 4>;
struct U {
a : UArr;
};
}
[[group(1), binding(0)]] var<uniform> u : U;
@ -1002,7 +1002,7 @@ TEST_F(RobustnessTest, OmitUniform) {
struct S {
a : array<f32, 4>;
b : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> s : S;
@ -1010,7 +1010,7 @@ type UArr = [[stride(16)]] array<f32, 4>;
struct U {
a : UArr;
};
}
[[group(1), binding(0)]] var<uniform> u : U;
@ -1067,7 +1067,7 @@ TEST_F(RobustnessTest, OmitBoth) {
struct S {
a : array<f32, 4>;
b : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> s : S;
@ -1075,7 +1075,7 @@ type UArr = [[stride(16)]] array<f32, 4>;
struct U {
a : UArr;
};
}
[[group(1), binding(0)]] var<uniform> u : U;

View File

@ -168,7 +168,7 @@ fn matrix() {
auto* expect = R"(
struct S {
i : i32;
};
}
fn arr() {
var a : array<S, 2>;
@ -325,11 +325,11 @@ fn z() -> i32 {
struct Inner {
a : array<i32, 2>;
};
}
struct Outer {
a : array<Inner, 2>;
};
}
fn f() {
var arr : array<Outer, 2>;

View File

@ -102,7 +102,7 @@ fn Y() {
auto* expect = R"(
struct a {
m : i32;
};
}
fn X() {
var a_1 = true;

View File

@ -109,7 +109,7 @@ fn main() -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[stage(vertex)]]
fn main() -> [[builtin(position)]] vec4<f32> {
@ -138,7 +138,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -176,7 +176,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -214,7 +214,7 @@ fn main([[location(0)]] var_a : f32) -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(5)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -257,14 +257,14 @@ fn main(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
struct Inputs {
[[location(0)]]
var_a : f32;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] tint_pulling_vertex_index : u32) -> [[builtin(position)]] vec4<f32> {
@ -305,7 +305,7 @@ fn main([[location(0)]] var_a : f32,
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -365,7 +365,7 @@ fn main(inputs : Inputs) -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -376,7 +376,7 @@ struct tint_symbol {
custom_vertex_index : u32;
[[builtin(instance_index)]]
custom_instance_index : u32;
};
}
struct Inputs {
[[location(0)]]
@ -387,7 +387,7 @@ struct Inputs {
custom_vertex_index : u32;
[[builtin(instance_index)]]
custom_instance_index : u32;
};
}
[[stage(vertex)]]
fn main(tint_symbol_1 : tint_symbol) -> [[builtin(position)]] vec4<f32> {
@ -447,7 +447,7 @@ fn main(inputs : Inputs, indices : Indices) -> [[builtin(position)]] vec4<f32> {
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -458,14 +458,14 @@ struct Inputs {
var_a : f32;
[[location(1)]]
var_b : f32;
};
}
struct Indices {
[[builtin(vertex_index)]]
custom_vertex_index : u32;
[[builtin(instance_index)]]
custom_instance_index : u32;
};
}
[[stage(vertex)]]
fn main(indices : Indices) -> [[builtin(position)]] vec4<f32> {
@ -514,7 +514,7 @@ fn main([[location(0)]] var_a : f32,
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -559,7 +559,7 @@ fn main([[location(0)]] var_a : vec2<f32>,
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -615,7 +615,7 @@ fn main([[location(0)]] var_a : f32,
auto* expect = R"(
struct TintVertexData {
tint_vertex_data_1 : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0_1 : TintVertexData;
@ -692,7 +692,7 @@ fn main(
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -852,7 +852,7 @@ fn main(
R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;
@ -1011,7 +1011,7 @@ fn main(
auto* expect = R"(
struct TintVertexData {
tint_vertex_data : [[stride(4)]] array<u32>;
};
}
[[binding(0), group(4)]] var<storage, read> tint_pulling_vertex_buffer_0 : TintVertexData;

View File

@ -41,7 +41,7 @@ var<private> arr : array<i32, 4>;
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
var<private> arr : tint_array_wrapper;
)";
@ -61,7 +61,7 @@ fn f() {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
fn f() {
var arr : tint_array_wrapper;
@ -83,7 +83,7 @@ fn f(a : array<i32, 4>) -> i32 {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
fn f(a : tint_array_wrapper) -> i32 {
return a.arr[2];
@ -104,7 +104,7 @@ fn f() -> array<i32, 4> {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
fn f() -> tint_array_wrapper {
return tint_array_wrapper(array<i32, 4u>(1, 2, 3, 4));
@ -133,13 +133,13 @@ fn f() {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 2u>;
};
}
type Inner = tint_array_wrapper;
struct tint_array_wrapper_1 {
arr : array<tint_array_wrapper, 2u>;
};
}
type Array = tint_array_wrapper_1;
@ -169,17 +169,17 @@ struct S {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
struct tint_array_wrapper_1 {
arr : array<i32, 8u>;
};
}
struct S {
a : tint_array_wrapper;
b : tint_array_wrapper_1;
c : tint_array_wrapper;
};
}
)";
auto got = Run<WrapArraysInStructs>(src);
@ -198,21 +198,21 @@ struct S {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
struct tint_array_wrapper_1 {
arr : array<tint_array_wrapper, 4u>;
};
}
struct tint_array_wrapper_2 {
arr : array<tint_array_wrapper_1, 4u>;
};
}
struct S {
a : tint_array_wrapper;
b : tint_array_wrapper_1;
c : tint_array_wrapper_2;
};
}
)";
auto got = Run<WrapArraysInStructs>(src);
@ -235,21 +235,21 @@ fn f(s : S) -> i32 {
auto* expect = R"(
struct tint_array_wrapper {
arr : array<i32, 4u>;
};
}
struct tint_array_wrapper_1 {
arr : array<tint_array_wrapper, 4u>;
};
}
struct tint_array_wrapper_2 {
arr : array<tint_array_wrapper_1, 4u>;
};
}
struct S {
a : tint_array_wrapper;
b : tint_array_wrapper_1;
c : tint_array_wrapper_2;
};
}
fn f(s : S) -> i32 {
return ((s.a.arr[2] + s.b.arr[1].arr[2]) + s.c.arr[3].arr[1].arr[2]);
@ -283,7 +283,7 @@ type T0 = i32;
struct tint_array_wrapper {
arr : array<i32, 1u>;
};
}
type T1 = tint_array_wrapper;
@ -291,7 +291,7 @@ type T2 = i32;
struct tint_array_wrapper_1 {
arr : array<i32, 2u>;
};
}
fn f1(a : tint_array_wrapper_1) {
}
@ -300,7 +300,7 @@ type T3 = i32;
struct tint_array_wrapper_2 {
arr : array<i32, 3u>;
};
}
fn f2() {
var v : tint_array_wrapper_2;

View File

@ -118,7 +118,7 @@ var<workgroup> v : i32;
struct Params {
[[builtin(local_invocation_index)]]
local_idx : u32;
};
}
[[stage(compute), workgroup_size(1)]]
fn f(params : Params) {
@ -187,7 +187,7 @@ fn f([[builtin(local_invocation_index)]] local_idx : u32) {
struct S {
x : i32;
y : array<i32, 8>;
};
}
var<workgroup> a : i32;
@ -251,7 +251,7 @@ fn f([[builtin(local_invocation_index)]] local_idx : u32) {
struct S {
x : i32;
y : array<i32, 8>;
};
}
var<workgroup> a : i32;
@ -318,7 +318,7 @@ fn f([[builtin(local_invocation_index)]] local_idx : u32) {
struct S {
x : i32;
y : array<i32, 8>;
};
}
var<workgroup> a : i32;
@ -389,7 +389,7 @@ struct S {
x : array<array<i32, 8>, 10>;
y : array<i32, 8>;
z : array<array<array<i32, 8>, 10>, 20>;
};
}
var<workgroup> a : i32;
@ -473,7 +473,7 @@ fn f([[builtin(local_invocation_id)]] local_invocation_id : vec3<u32>) {
struct S {
x : i32;
y : array<i32, 8>;
};
}
var<workgroup> a : i32;
@ -546,7 +546,7 @@ fn f3() {
struct S {
x : i32;
y : array<i32, 8>;
};
}
var<workgroup> a : i32;
@ -711,7 +711,7 @@ struct S {
b : f32;
u : atomic<u32>;
c : u32;
};
}
var<workgroup> w : S;
@ -786,7 +786,7 @@ struct S {
b : f32;
u : atomic<u32>;
c : u32;
};
}
var<workgroup> w : array<S, 4>;

View File

@ -573,7 +573,7 @@ bool GeneratorImpl::EmitStructType(const ast::Struct* str) {
}
decrement_indent();
line() << "};";
line() << "}";
return true;
}

View File

@ -46,7 +46,7 @@ TEST_F(WgslGeneratorImplTest, EmitTypeDecl_Struct) {
EXPECT_EQ(gen.result(), R"(struct A {
a : f32;
b : i32;
};
}
type B = A;
)");
}

View File

@ -213,7 +213,7 @@ TEST_F(WgslGeneratorImplTest,
EXPECT_EQ(gen.result(), R"([[block]]
struct Data {
d : f32;
};
}
[[binding(0), group(0)]] var<storage, read_write> data : Data;

View File

@ -79,7 +79,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
struct S0 {
a : i32;
};
}
fn func() -> f32 {
return a0;
@ -89,7 +89,7 @@ TEST_F(WgslGeneratorImplTest, Emit_GlobalsInterleaved) {
struct S1 {
a : i32;
};
}
[[stage(compute), workgroup_size(1)]]
fn main() {

View File

@ -168,7 +168,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl) {
[[size(4)]]
padding_1 : u32;
b : f32;
};
}
)");
}
@ -189,7 +189,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructOffsetDecl_WithSymbolCollisions) {
[[size(4)]]
padding_1 : u32;
tint_2_padding : f32;
};
}
)");
}
@ -207,7 +207,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructAlignDecl) {
a : i32;
[[align(16)]]
b : f32;
};
}
)");
}
@ -225,7 +225,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructSizeDecl) {
a : i32;
[[size(32)]]
b : f32;
};
}
)");
}
@ -245,7 +245,7 @@ struct S {
a : i32;
[[align(8)]]
b : f32;
};
}
)");
}
@ -269,7 +269,7 @@ struct S {
a : u32;
[[location(2)]]
b : f32;
};
}
)");
}

View File

@ -2,7 +2,7 @@ type ArrayType = [[stride(16)]] array<i32, 4>;
struct S {
arr : ArrayType;
};
}
var<private> src_private : ArrayType;

View File

@ -2,7 +2,7 @@ type ArrayType = [[stride(16)]] array<i32, 4>;
struct S {
arr : ArrayType;
};
}
var<private> src_private : ArrayType;

View File

@ -2,11 +2,11 @@ type ArrayType = [[stride(16)]] array<i32, 4>;
struct S {
arr : ArrayType;
};
}
struct S_nested {
arr : array<array<array<i32, 2>, 3>, 4>;
};
}
var<private> src_private : ArrayType;

View File

@ -2,7 +2,7 @@ type ArrayType = array<i32, 4>;
struct S {
arr : array<i32, 4>;
};
}
fn foo() {
let src : ArrayType = ArrayType();

View File

@ -2,7 +2,7 @@ type ArrayType = [[stride(16)]] array<i32, 4>;
struct S {
arr : ArrayType;
};
}
var<private> src_private : ArrayType;

View File

@ -10,7 +10,7 @@ struct RenderParams {
modelViewProjectionMatrix : mat4x4<f32>;
right : vec3<f32>;
up : vec3<f32>;
};
}
[[binding(0), group(0)]] var<uniform> render_params : RenderParams;
@ -21,7 +21,7 @@ struct VertexInput {
color : vec4<f32>;
[[location(2)]]
quad_pos : vec2<f32>;
};
}
struct VertexOutput {
[[builtin(position)]]
@ -30,7 +30,7 @@ struct VertexOutput {
color : vec4<f32>;
[[location(1)]]
quad_pos : vec2<f32>;
};
}
[[stage(vertex)]]
fn vs_main(in : VertexInput) -> VertexOutput {
@ -53,18 +53,18 @@ fn fs_main(in : VertexOutput) -> [[location(0)]] vec4<f32> {
struct SimulationParams {
deltaTime : f32;
seed : vec4<f32>;
};
}
struct Particle {
position : vec3<f32>;
lifetime : f32;
color : vec4<f32>;
velocity : vec3<f32>;
};
}
struct Particles {
particles : array<Particle>;
};
}
[[binding(0), group(0)]] var<uniform> sim_params : SimulationParams;
@ -104,11 +104,11 @@ fn simulate([[builtin(global_invocation_id)]] GlobalInvocationID : vec3<u32>) {
struct UBO {
width : u32;
};
}
struct Buffer {
weights : array<f32>;
};
}
[[binding(3), group(0)]] var<uniform> ubo : UBO;

View File

@ -1,6 +1,6 @@
struct SB {
data : array<i32>;
};
}
[[group(0), binding(0)]] var<storage, read_write> buffer : SB;

View File

@ -1,12 +1,12 @@
struct Input {
[[location(0)]]
color : vec4<f32>;
};
}
struct Output {
[[location(0)]]
color : vec4<f32>;
};
}
[[stage(fragment)]]
fn main(in : Input) -> Output {

View File

@ -1,12 +1,12 @@
struct Input {
[[location(0)]]
position : vec4<f32>;
};
}
struct Output {
[[builtin(position)]]
position : vec4<f32>;
};
}
[[stage(vertex)]]
fn main(in : Input) -> Output {

View File

@ -8,11 +8,11 @@ struct Inner {
g : mat2x3<f32>;
h : mat3x2<f32>;
i : [[stride(16)]] array<vec4<i32>, 4>;
};
}
struct S {
arr : array<Inner>;
};
}
[[binding(0), group(0)]] var<storage, read> s : S;

View File

@ -8,11 +8,11 @@ struct Inner {
g : mat2x3<f32>;
h : mat3x2<f32>;
i : [[stride(16)]] array<vec4<i32>, 4>;
};
}
struct S {
arr : array<Inner>;
};
}
[[binding(0), group(0)]] var<storage, read_write> s : S;

View File

@ -1,6 +1,6 @@
struct Inner {
x : i32;
};
}
struct S {
a : vec3<i32>;
@ -13,7 +13,7 @@ struct S {
h : mat3x2<f32>;
i : Inner;
j : [[stride(16)]] array<Inner, 4>;
};
}
[[binding(0), group(0)]] var<storage, read> s : S;

View File

@ -1,6 +1,6 @@
struct Inner {
x : i32;
};
}
struct S {
a : vec3<i32>;
@ -13,7 +13,7 @@ struct S {
h : mat3x2<f32>;
i : Inner;
j : [[stride(16)]] array<Inner, 4>;
};
}
[[binding(0), group(0)]] var<storage, write> s : S;

View File

@ -1,6 +1,6 @@
struct S {
f : f32;
};
}
[[group(0), binding(0)]] var<storage, read> in : array<S>;

View File

@ -1,10 +1,10 @@
struct Inner {
f : f32;
};
}
struct S {
inner : Inner;
};
}
[[group(0), binding(0)]] var<storage, read> in : S;

View File

@ -12,11 +12,11 @@ struct Inner {
j : mat3x2<f32>;
[[align(16)]]
k : [[stride(16)]] array<vec4<i32>, 4>;
};
}
struct S {
arr : array<Inner, 8>;
};
}
[[binding(0), group(0)]] var<uniform> s : S;

View File

@ -1,6 +1,6 @@
struct Inner {
x : i32;
};
}
struct S {
a : vec3<i32>;
@ -17,7 +17,7 @@ struct S {
k : Inner;
[[align(16)]]
l : [[stride(16)]] array<Inner, 4>;
};
}
[[binding(0), group(0)]] var<uniform> s : S;

View File

@ -1,10 +1,10 @@
struct Inner {
f : f32;
};
}
struct S {
inner : Inner;
};
}
[[group(0), binding(0)]] var<uniform> u : S;

View File

@ -3,14 +3,14 @@ struct VertexInputs0 {
vertex_index : u32;
[[location(0)]]
loc0 : i32;
};
}
struct VertexInputs1 {
[[location(2)]]
loc1 : u32;
[[location(3)]]
loc3 : vec4<f32>;
};
}
[[stage(vertex)]]
fn main(inputs0 : VertexInputs0, [[location(1)]] loc1 : u32, [[builtin(instance_index)]] instance_index : u32, inputs1 : VertexInputs1) -> [[builtin(position)]] vec4<f32> {

View File

@ -36,7 +36,7 @@ struct Uniforms {
pad2 : u32;
bbMin : vec3<f32>;
bbMax : vec3<f32>;
};
}
struct Dbg {
offsetCounter : atomic<u32>;
@ -51,27 +51,27 @@ struct Dbg {
value_f32_1 : f32;
value_f32_2 : f32;
value_f32_3 : f32;
};
}
struct F32s {
values : [[stride(4)]] array<f32>;
};
}
struct U32s {
values : [[stride(4)]] array<u32>;
};
}
struct I32s {
values : [[stride(4)]] array<i32>;
};
}
struct AU32s {
values : [[stride(4)]] array<atomic<u32>>;
};
}
struct AI32s {
values : [[stride(4)]] array<atomic<i32>>;
};
}
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;

View File

@ -1,10 +1,10 @@
struct A {
a : i32;
};
}
struct B {
b : i32;
};
}
fn f(a : A) -> B {
return B();

View File

@ -1,7 +1,7 @@
struct Uniforms {
u_scale : vec2<f32>;
u_offset : vec2<f32>;
};
}
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
@ -10,7 +10,7 @@ struct VertexOutputs {
texcoords : vec2<f32>;
[[builtin(position)]]
position : vec4<f32>;
};
}
[[stage(vertex)]]
fn vs_main([[builtin(vertex_index)]] VertexIndex : u32) -> VertexOutputs {

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,18 +1,18 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct Result {
out : i32;
};
}
[[group(0), binding(2)]] var<storage, read_write> result : Result;
struct SSBO {
data : array<i32, 4>;
};
}
[[group(0), binding(1)]] var<storage, read_write> ssbo : SSBO;

View File

@ -1,13 +1,13 @@
struct UBO {
data : [[stride(16)]] array<i32, 4>;
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct Result {
out : i32;
};
}
[[group(0), binding(2)]] var<storage, read_write> result : Result;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,18 +1,18 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct Result {
out : i32;
};
}
[[group(0), binding(2)]] var<storage, read_write> result : Result;
struct SSBO {
data : array<i32, 4>;
};
}
[[group(0), binding(1)]] var<storage, read_write> ssbo : SSBO;

View File

@ -1,16 +1,16 @@
struct UBO {
dynamic_idx : i32;
};
}
[[group(0), binding(0)]] var<uniform> ubo : UBO;
struct S {
data : array<i32, 64>;
};
}
struct Result {
out : i32;
};
}
[[group(0), binding(1)]] var<storage, read_write> result : Result;

View File

@ -1,17 +1,17 @@
struct Simulation {
i : u32;
};
}
struct Particle {
position : array<vec3<f32>, 8>;
lifetime : f32;
color : vec4<f32>;
velocity : vec3<f32>;
};
}
struct Particles {
p : array<Particle>;
};
}
[[group(1), binding(3)]] var<storage, read> particles : Particles;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,7 +1,7 @@
struct Uniforms {
i : u32;
j : u32;
};
}
[[group(1), binding(4)]] var<uniform> uniforms : Uniforms;

View File

@ -1,10 +1,10 @@
struct PointLight {
position : vec4<f32>;
};
}
struct PointLights {
values : [[stride(16)]] array<PointLight>;
};
}
struct Uniforms {
worldView : mat4x4<f32>;
@ -12,7 +12,7 @@ struct Uniforms {
numPointLights : u32;
color_source : u32;
color : vec4<f32>;
};
}
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;
@ -33,12 +33,12 @@ struct FragmentInput {
uv : vec2<f32>;
[[location(3)]]
color : vec4<f32>;
};
}
struct FragmentOutput {
[[location(0)]]
color : vec4<f32>;
};
}
fn getColor(fragment : FragmentInput) -> vec4<f32> {
var color : vec4<f32>;

View File

@ -3,7 +3,7 @@ struct FragIn {
a : f32;
[[builtin(sample_mask)]]
mask : u32;
};
}
[[stage(fragment)]]
fn main(in : FragIn, [[location(1)]] b : f32) -> FragIn {

View File

@ -9,7 +9,7 @@ struct LeftOver {
padding : u32;
test2 : Arr;
test : Arr_1;
};
}
var<private> position : vec3<f32>;
@ -53,7 +53,7 @@ struct main_out {
gl_Position : vec4<f32>;
[[location(0)]]
vUV_1 : vec2<f32>;
};
}
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec3<f32>, [[location(2)]] uv_param : vec2<f32>, [[location(1)]] normal_param : vec3<f32>) -> main_out {

View File

@ -5,7 +5,7 @@ struct Uniforms {
pad2 : u32;
bbMin : vec3<f32>;
bbMax : vec3<f32>;
};
}
struct Dbg {
offsetCounter : atomic<u32>;
@ -20,27 +20,27 @@ struct Dbg {
value_f32_1 : f32;
value_f32_2 : f32;
value_f32_3 : f32;
};
}
struct F32s {
values : [[stride(4)]] array<f32>;
};
}
struct U32s {
values : [[stride(4)]] array<u32>;
};
}
struct I32s {
values : [[stride(4)]] array<i32>;
};
}
struct AU32s {
values : [[stride(4)]] array<atomic<u32>>;
};
}
struct AI32s {
values : [[stride(4)]] array<atomic<i32>>;
};
}
[[binding(0), group(0)]] var<uniform> uniforms : Uniforms;

View File

@ -2,22 +2,22 @@ struct LightData {
position : vec4<f32>;
color : vec3<f32>;
radius : f32;
};
}
struct LightsBuffer {
lights : array<LightData>;
};
}
[[group(0), binding(0)]] var<storage, read_write> lightsBuffer : LightsBuffer;
struct TileLightIdData {
count : atomic<u32>;
lightId : array<u32, 64>;
};
}
struct Tiles {
data : array<TileLightIdData, 4>;
};
}
[[group(1), binding(0)]] var<storage, read_write> tileLightId : Tiles;
@ -28,7 +28,7 @@ struct Config {
tileCountY : u32;
numTileLightSlot : u32;
tileSize : u32;
};
}
[[group(2), binding(0)]] var<uniform> config : Config;
@ -38,7 +38,7 @@ struct Uniforms {
viewMatrix : mat4x4<f32>;
projectionMatrix : mat4x4<f32>;
fullScreenSize : vec4<f32>;
};
}
[[group(3), binding(0)]] var<uniform> uniforms : Uniforms;

View File

@ -1,6 +1,6 @@
struct Buffer {
data : u32;
};
}
[[group(0), binding(0)]] var<storage, read_write> buffer : Buffer;

View File

@ -3,7 +3,7 @@ type Arr = array<u32, 50>;
struct Buf {
count : u32;
data : Arr;
};
}
[[group(0), binding(0)]] var<storage, read_write> b : Buf;

View File

@ -1,10 +1,10 @@
struct Light {
position : vec3<f32>;
colour : vec3<f32>;
};
}
struct Lights {
light : [[stride(32)]] array<Light>;
};
}
[[group(0), binding(1)]] var<storage, read> lights : Lights;

View File

@ -1,6 +1,6 @@
struct S {
m : mat2x2<f32>;
};
}
[[group(0), binding(0)]] var<storage> SSBO : S;

View File

@ -1,10 +1,10 @@
struct vertexUniformBuffer1 {
transform1 : mat2x2<f32>;
};
}
struct vertexUniformBuffer2 {
transform2 : mat2x2<f32>;
};
}
[[group(0), binding(0)]] var<uniform> x_20 : vertexUniformBuffer1;

View File

@ -1,6 +1,6 @@
struct S {
a : i32;
};
}
[[group(0), binding(0)]] var<storage, read_write> buf : S;

View File

@ -3,11 +3,11 @@ struct Uniforms {
isFloat16 : u32;
isRGB10A2Unorm : u32;
channelCount : u32;
};
}
struct OutputBuf {
result : [[stride(4)]] array<u32>;
};
}
[[group(0), binding(0)]] var src : texture_2d<f32>;

View File

@ -2,11 +2,11 @@ struct Uniforms {
aShape : vec2<u32>;
bShape : vec2<u32>;
outShape : vec2<u32>;
};
}
struct Matrix {
numbers : array<u32>;
};
}
[[group(0), binding(0)]] var<storage, read> firstMatrix : Matrix;

View File

@ -1,10 +1,10 @@
struct QuicksortObject {
numbers : array<i32, 10u>;
};
}
struct buf0 {
resolution : vec2<f32>;
};
}
var<private> obj : QuicksortObject;
@ -1476,7 +1476,7 @@ fn main_1() {
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
}
[[stage(fragment)]]
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {

View File

@ -1,6 +1,6 @@
struct Constants {
level : i32;
};
}
[[group(0), binding(0)]] var<uniform> constants : Constants;
@ -8,7 +8,7 @@ struct Constants {
struct Result {
values : [[stride(4)]] array<f32>;
};
}
[[group(0), binding(3)]] var<storage, read_write> result : Result;

View File

@ -3,7 +3,7 @@ struct Output {
Position : vec4<f32>;
[[location(0)]]
color : vec4<f32>;
};
}
[[stage(vertex)]]
fn main([[builtin(vertex_index)]] VertexIndex : u32, [[builtin(instance_index)]] InstanceIndex : u32) -> Output {

View File

@ -1,6 +1,6 @@
struct Result {
values : array<f32>;
};
}
let width : u32 = 128u;

View File

@ -5,11 +5,11 @@ struct sspp962805860buildInformationS {
offset : vec4<f32>;
essence : i32;
orientation : Arr;
};
}
struct x_B4_BuildInformation {
passthru : sspp962805860buildInformationS;
};
}
[[group(0), binding(2)]] var<storage, read> sspp962805860buildInformation : x_B4_BuildInformation;

View File

@ -4,11 +4,11 @@ struct Uniforms {
srcCopyOrigin : vec2<u32>;
dstCopyOrigin : vec2<u32>;
copySize : vec2<u32>;
};
}
struct OutputBuf {
result : array<u32>;
};
}
[[group(0), binding(0)]] var src : texture_2d<f32>;

View File

@ -2,11 +2,11 @@ struct Uniforms {
dimAOuter : u32;
dimInner : u32;
dimBOuter : u32;
};
}
struct Matrix {
numbers : array<f32>;
};
}
[[group(0), binding(0)]] var<storage, read> firstMatrix : Matrix;

View File

@ -3,31 +3,31 @@ struct Mat4x4_ {
my : vec4<f32>;
mz : vec4<f32>;
mw : vec4<f32>;
};
}
struct Mat4x3_ {
mx : vec4<f32>;
my : vec4<f32>;
mz : vec4<f32>;
};
}
struct Mat4x2_ {
mx : vec4<f32>;
my : vec4<f32>;
};
}
struct ub_SceneParams {
u_Projection : Mat4x4_;
};
}
struct ub_MaterialParams {
u_TexMtx : [[stride(32)]] array<Mat4x2_, 1>;
u_Misc0_ : vec4<f32>;
};
}
struct ub_PacketParams {
u_PosMtx : [[stride(48)]] array<Mat4x3_, 32>;
};
}
struct VertexOutput {
[[location(0)]]
@ -36,7 +36,7 @@ struct VertexOutput {
v_TexCoord : vec2<f32>;
[[builtin(position)]]
member : vec4<f32>;
};
}
[[group(0), binding(0)]] var<uniform> global : ub_SceneParams;

View File

@ -1,6 +1,6 @@
struct DrawIndirectArgs {
vertexCount : atomic<u32>;
};
}
[[group(0), binding(5)]] var<storage, read_write> drawOut : DrawIndirectArgs;

Some files were not shown because too many files have changed in this diff Show More