From 8b685866cdce927f75d5d42f310494cd0ad4b03d Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Sun, 20 Sep 2020 19:14:28 +0000 Subject: [PATCH] [wgsl-reader][wgsl-writer] Update struct decorations to new syntax. This CL updates the parsing of struct decorations to require ()'s around parameters. Bug: tint:238 Change-Id: Ia35ca5c260c3c57b5fc95788bd1aef07f75edc39 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28600 Reviewed-by: Sarah Mashayekhi Commit-Queue: Sarah Mashayekhi --- src/reader/wgsl/parser_impl.cc | 14 +++- .../wgsl/parser_impl_struct_body_decl_test.cc | 2 +- .../wgsl/parser_impl_struct_decl_test.cc | 2 +- ...impl_struct_member_decoration_decl_test.cc | 12 +-- ...rser_impl_struct_member_decoration_test.cc | 26 ++++-- .../wgsl/parser_impl_struct_member_test.cc | 8 +- .../wgsl/parser_impl_type_alias_test.cc | 3 +- .../generator_impl_member_accessor_test.cc | 80 +++++++++---------- src/writer/wgsl/generator_impl.cc | 2 +- .../wgsl/generator_impl_alias_type_test.cc | 2 +- src/writer/wgsl/generator_impl_type_test.cc | 4 +- test/compute_boids.wgsl | 20 ++--- test/cube.wgsl | 2 +- 13 files changed, 103 insertions(+), 74 deletions(-) diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index a85f7c7331..5781a7902e 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -1641,7 +1641,7 @@ ast::StructMemberDecorationList ParserImpl::struct_member_decoration_decl() { } // struct_member_decoration -// : OFFSET INT_LITERAL +// : OFFSET PAREN_LEFT INT_LITERAL PAREN_RIGHT std::unique_ptr ParserImpl::struct_member_decoration() { auto t = peek(); @@ -1650,6 +1650,12 @@ ParserImpl::struct_member_decoration() { next(); // Consume the peek + t = next(); + if (!t.IsParenLeft()) { + set_error(t, "missing ( for offset"); + return nullptr; + } + t = next(); if (!t.IsSintLiteral()) { set_error(t, "invalid value for offset decoration"); @@ -1661,6 +1667,12 @@ ParserImpl::struct_member_decoration() { return nullptr; } + t = next(); + if (!t.IsParenRight()) { + set_error(t, "missing ) for offset"); + return nullptr; + } + return std::make_unique(val); } diff --git a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc index ecf29a99a1..93d097503d 100644 --- a/src/reader/wgsl/parser_impl_struct_body_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_body_decl_test.cc @@ -47,7 +47,7 @@ TEST_F(ParserImplTest, StructBodyDecl_ParsesEmpty) { TEST_F(ParserImplTest, StructBodyDecl_InvalidMember) { auto* p = parser(R"( { - [[offset nan]] a : i32; + [[offset(nan)]] a : i32; })"); auto m = p->struct_body_decl(); ASSERT_TRUE(p->has_error()); diff --git a/src/reader/wgsl/parser_impl_struct_decl_test.cc b/src/reader/wgsl/parser_impl_struct_decl_test.cc index bb91899496..b1480e1aae 100644 --- a/src/reader/wgsl/parser_impl_struct_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_decl_test.cc @@ -26,7 +26,7 @@ TEST_F(ParserImplTest, StructDecl_Parses) { auto* p = parser(R"( struct { a : i32; - [[offset 4 ]] b : f32; + [[offset(4)]] b : f32; })"); auto s = p->struct_decl(); ASSERT_FALSE(p->has_error()); diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc index ea54e9c5e9..9f57e0eb95 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_decl_test.cc @@ -37,7 +37,7 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_EmptyBlock) { } TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) { - auto* p = parser("[[offset 4]]"); + auto* p = parser("[[offset(4)]]"); auto deco = p->struct_member_decoration_decl(); ASSERT_FALSE(p->has_error()); ASSERT_EQ(deco.size(), 1u); @@ -45,24 +45,24 @@ TEST_F(ParserImplTest, StructMemberDecorationDecl_Single) { } TEST_F(ParserImplTest, StructMemberDecorationDecl_HandlesDuplicate) { - auto* p = parser("[[offset 2, offset 4]]"); + auto* p = parser("[[offset(2), offset(4)]]"); auto deco = p->struct_member_decoration_decl(); ASSERT_TRUE(p->has_error()) << p->error(); - EXPECT_EQ(p->error(), "1:21: duplicate offset decoration found"); + EXPECT_EQ(p->error(), "1:23: duplicate offset decoration found"); } TEST_F(ParserImplTest, StructMemberDecorationDecl_InvalidDecoration) { - auto* p = parser("[[offset nan]]"); + auto* p = parser("[[offset(nan)]]"); auto deco = p->struct_member_decoration_decl(); ASSERT_TRUE(p->has_error()) << p->error(); EXPECT_EQ(p->error(), "1:10: invalid value for offset decoration"); } TEST_F(ParserImplTest, StructMemberDecorationDecl_MissingClose) { - auto* p = parser("[[offset 4"); + auto* p = parser("[[offset(4)"); auto deco = p->struct_member_decoration_decl(); ASSERT_TRUE(p->has_error()) << p->error(); - EXPECT_EQ(p->error(), "1:11: missing ]] for struct member decoration"); + EXPECT_EQ(p->error(), "1:12: missing ]] for struct member decoration"); } } // namespace diff --git a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc index 7be4bceeeb..c01be5305b 100644 --- a/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_decoration_test.cc @@ -23,7 +23,7 @@ namespace wgsl { namespace { TEST_F(ParserImplTest, StructMemberDecoration_Offset) { - auto* p = parser("offset 4"); + auto* p = parser("offset(4)"); auto deco = p->struct_member_decoration(); ASSERT_NE(deco, nullptr); ASSERT_FALSE(p->has_error()); @@ -33,16 +33,32 @@ TEST_F(ParserImplTest, StructMemberDecoration_Offset) { EXPECT_EQ(o->offset(), 4u); } -TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingValue) { - auto* p = parser("offset"); +TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingLeftParen) { + auto* p = parser("offset 4)"); auto deco = p->struct_member_decoration(); ASSERT_EQ(deco, nullptr); ASSERT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:7: invalid value for offset decoration"); + EXPECT_EQ(p->error(), "1:8: missing ( for offset"); +} + +TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingRightParen) { + auto* p = parser("offset(4"); + auto deco = p->struct_member_decoration(); + ASSERT_EQ(deco, nullptr); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:9: missing ) for offset"); +} + +TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingValue) { + auto* p = parser("offset()"); + auto deco = p->struct_member_decoration(); + ASSERT_EQ(deco, nullptr); + ASSERT_TRUE(p->has_error()); + EXPECT_EQ(p->error(), "1:8: invalid value for offset decoration"); } TEST_F(ParserImplTest, StructMemberDecoration_Offset_MissingInvalid) { - auto* p = parser("offset nan"); + auto* p = parser("offset(nan)"); auto deco = p->struct_member_decoration(); ASSERT_EQ(deco, nullptr); ASSERT_TRUE(p->has_error()); diff --git a/src/reader/wgsl/parser_impl_struct_member_test.cc b/src/reader/wgsl/parser_impl_struct_member_test.cc index 49bc44c10e..7efe135bf3 100644 --- a/src/reader/wgsl/parser_impl_struct_member_test.cc +++ b/src/reader/wgsl/parser_impl_struct_member_test.cc @@ -40,7 +40,7 @@ TEST_F(ParserImplTest, StructMember_Parses) { TEST_F(ParserImplTest, StructMember_ParsesWithDecoration) { auto* i32 = tm()->Get(std::make_unique()); - auto* p = parser("[[offset 2]] a : i32;"); + auto* p = parser("[[offset(2)]] a : i32;"); auto m = p->struct_member(); ASSERT_FALSE(p->has_error()); ASSERT_NE(m, nullptr); @@ -53,7 +53,7 @@ TEST_F(ParserImplTest, StructMember_ParsesWithDecoration) { } TEST_F(ParserImplTest, StructMember_InvalidDecoration) { - auto* p = parser("[[offset nan]] a : i32;"); + auto* p = parser("[[offset(nan)]] a : i32;"); auto m = p->struct_member(); ASSERT_TRUE(p->has_error()); ASSERT_EQ(m, nullptr); @@ -61,11 +61,11 @@ TEST_F(ParserImplTest, StructMember_InvalidDecoration) { } TEST_F(ParserImplTest, StructMember_InvalidVariable) { - auto* p = parser("[[offset 4]] a : B;"); + auto* p = parser("[[offset(4)]] a : B;"); auto m = p->struct_member(); ASSERT_TRUE(p->has_error()); ASSERT_EQ(m, nullptr); - EXPECT_EQ(p->error(), "1:18: unknown type alias 'B'"); + EXPECT_EQ(p->error(), "1:19: unknown type alias 'B'"); } TEST_F(ParserImplTest, StructMember_MissingSemicolon) { diff --git a/src/reader/wgsl/parser_impl_type_alias_test.cc b/src/reader/wgsl/parser_impl_type_alias_test.cc index 2995881b60..d60360b197 100644 --- a/src/reader/wgsl/parser_impl_type_alias_test.cc +++ b/src/reader/wgsl/parser_impl_type_alias_test.cc @@ -91,7 +91,8 @@ TEST_F(ParserImplTest, TypeDecl_InvalidStruct) { TEST_F(ParserImplTest, TypeDecl_Struct_WithStride) { auto* p = parser( - "type a = [[block]] struct { [[offset 0]] data: [[stride 4]] array; " + "type a = [[block]] struct { [[offset(0)]] data: [[stride 4]] " + "array; " "}"); auto* t = p->type_alias(); ASSERT_FALSE(p->has_error()); diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc index 748b783158..8f75a4a771 100644 --- a/src/writer/hlsl/generator_impl_member_accessor_test.cc +++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc @@ -80,8 +80,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) { TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load) { // struct Data { - // [[offset 0]] a : i32; - // [[offset 4]] b : f32; + // [[offset(0)]] a : i32; + // [[offset(4)]] b : f32; // }; // var data : Data; // data.b; @@ -129,8 +129,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_Int) { // struct Data { - // [[offset 0]] a : i32; - // [[offset 4]] b : f32; + // [[offset(0)]] a : i32; + // [[offset(4)]] b : f32; // }; // var data : Data; // data.a; @@ -177,8 +177,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_Matrix) { // struct Data { - // [[offset 0]] z : f32; - // [[offset 4]] a : mat2x3; + // [[offset(0)]] z : f32; + // [[offset(4)]] a : mat2x3; // }; // var data : Data; // mat2x3 b; @@ -241,8 +241,8 @@ data.Store3(4 + 16, asuint(_tint_tmp[1])); TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_Matrix_Empty) { // struct Data { - // [[offset 0]] z : f32; - // [[offset 4]] a : mat2x3; + // [[offset(0)]] z : f32; + // [[offset(4)]] a : mat2x3; // }; // var data : Data; // data.a = mat2x3(); @@ -303,8 +303,8 @@ data.Store3(4 + 16, asuint(_tint_tmp[1])); TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_Matrix) { // struct Data { - // [[offset 0]] z : f32; - // [[offset 4]] a : mat3x2; + // [[offset(0)]] z : f32; + // [[offset(4)]] a : mat3x2; // }; // var data : Data; // data.a; @@ -356,12 +356,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_Matrix_Nested) { // struct Data { - // [[offset 0]] z : f32; - // [[offset 4]] a : mat2x3 data : Outer; // data.b.a; @@ -413,7 +413,7 @@ TEST_F( HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_Matrix_By3_Is_16_Bytes) { // struct Data { - // [[offset 4]] a : mat3x3 data : Data; // data.a; @@ -460,8 +460,8 @@ TEST_F( TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_Matrix_Single_Element) { // struct Data { - // [[offset 0]] z : f32; - // [[offset 16]] a : mat4x3; + // [[offset(0)]] z : f32; + // [[offset(16)]] a : mat4x3; // }; // var data : Data; // data.a[2][1]; @@ -516,7 +516,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_ArrayAccessor_StorageBuffer_Load_Int_FromArray) { // struct Data { - // [[offset 0]] a : [[stride 4]] array; + // [[offset(0)]] a : [[stride 4]] array; // }; // var data : Data; // data.a[2]; @@ -564,7 +564,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_ArrayAccessor_StorageBuffer_Load_Int_FromArray_ExprIdx) { // struct Data { - // [[offset 0]] a : [[stride 4]] array; + // [[offset(0)]] a : [[stride 4]] array; // }; // var data : Data; // data.a[(2 + 4) - 3]; @@ -620,8 +620,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store) { // struct Data { - // [[offset 0]] a : i32; - // [[offset 4]] b : f32; + // [[offset(0)]] a : i32; + // [[offset(4)]] b : f32; // }; // var data : Data; // data.b = 2.3f; @@ -674,7 +674,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_ToArray) { // struct Data { - // [[offset 0]] a : [[stride 4]] array; + // [[offset(0)]] a : [[stride 4]] array; // }; // var data : Data; // data.a[2] = 2; @@ -727,8 +727,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_Int) { // struct Data { - // [[offset 0]] a : i32; - // [[offset 4]] b : f32; + // [[offset(0)]] a : i32; + // [[offset(4)]] b : f32; // }; // var data : Data; // data.a = 2; @@ -781,8 +781,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_Vec3) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // var data : Data; // data.b; @@ -833,8 +833,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_Vec3) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // var data : Data; // data.b = vec3(2.3f, 1.2f, 0.2f); @@ -903,8 +903,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_MultiLevel) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // struct Pre { // var c : [[stride 32]] array; @@ -976,8 +976,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_MultiLevel_Swizzle) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // struct Pre { // var c : [[stride 32]] array; @@ -1052,8 +1052,8 @@ TEST_F( HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_MultiLevel_Swizzle_SingleLetter) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // struct Pre { // var c : [[stride 32]] array; @@ -1127,8 +1127,8 @@ TEST_F( TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Load_MultiLevel_Index) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // struct Pre { // var c : [[stride 32]] array; @@ -1203,8 +1203,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_MultiLevel) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // struct Pre { // var c : [[stride 32]] array; @@ -1295,8 +1295,8 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor_StorageBuffer_Store_Swizzle_SingleLetter) { // struct Data { - // [[offset 0]] a : vec3; - // [[offset 16]] b : vec3; + // [[offset(0)]] a : vec3; + // [[offset(16)]] b : vec3; // }; // struct Pre { // var c : [[stride 32]] array; diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc index c64a1b35a9..d13d1bb0e0 100644 --- a/src/writer/wgsl/generator_impl.cc +++ b/src/writer/wgsl/generator_impl.cc @@ -633,7 +633,7 @@ bool GeneratorImpl::EmitType(ast::type::Type* type) { // TODO(dsinclair): Split this out when we have more then one assert(deco->IsOffset()); - out_ << "offset " << deco->AsOffset()->offset(); + out_ << "offset(" << deco->AsOffset()->offset() << ")"; } out_ << "]] "; } diff --git a/src/writer/wgsl/generator_impl_alias_type_test.cc b/src/writer/wgsl/generator_impl_alias_type_test.cc index 8608f102cd..e0b04ff9f3 100644 --- a/src/writer/wgsl/generator_impl_alias_type_test.cc +++ b/src/writer/wgsl/generator_impl_alias_type_test.cc @@ -62,7 +62,7 @@ TEST_F(WgslGeneratorImplTest, EmitAliasType_Struct) { ASSERT_TRUE(g.EmitAliasType(&alias)) << g.error(); EXPECT_EQ(g.result(), R"(type a = struct { a : f32; - [[offset 4]] b : i32; + [[offset(4)]] b : i32; }; )"); } diff --git a/src/writer/wgsl/generator_impl_type_test.cc b/src/writer/wgsl/generator_impl_type_test.cc index fe099253ab..05aade7685 100644 --- a/src/writer/wgsl/generator_impl_type_test.cc +++ b/src/writer/wgsl/generator_impl_type_test.cc @@ -143,7 +143,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) { ASSERT_TRUE(g.EmitType(&s)) << g.error(); EXPECT_EQ(g.result(), R"(struct { a : i32; - [[offset 4]] b : f32; + [[offset(4)]] b : f32; })"); } @@ -170,7 +170,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithDecoration) { ASSERT_TRUE(g.EmitType(&s)) << g.error(); EXPECT_EQ(g.result(), R"([[block]] struct { a : i32; - [[offset 4]] b : f32; + [[offset(4)]] b : f32; })"); } diff --git a/test/compute_boids.wgsl b/test/compute_boids.wgsl index 5752620c2a..1cf7d3a9bc 100644 --- a/test/compute_boids.wgsl +++ b/test/compute_boids.wgsl @@ -42,22 +42,22 @@ entry_point fragment as "frag_main" = frag_main; # compute shader type Particle = [[block]] struct { - [[offset 0]] pos : vec2; - [[offset 8]] vel : vec2; + [[offset(0)]] pos : vec2; + [[offset(8)]] vel : vec2; }; type SimParams = [[block]] struct { - [[offset 0]] deltaT : f32; - [[offset 4]] rule1Distance : f32; - [[offset 8]] rule2Distance : f32; - [[offset 12]] rule3Distance : f32; - [[offset 16]] rule1Scale : f32; - [[offset 20]] rule2Scale : f32; - [[offset 24]] rule3Scale : f32; + [[offset(0)]] deltaT : f32; + [[offset(4)]] rule1Distance : f32; + [[offset(8)]] rule2Distance : f32; + [[offset(12)]] rule3Distance : f32; + [[offset(16)]] rule1Scale : f32; + [[offset(20)]] rule2Scale : f32; + [[offset(24)]] rule3Scale : f32; }; type Particles = [[block]] struct { - [[offset 0]] particles : [[stride 16]] array; + [[offset(0)]] particles : [[stride 16]] array; }; [[binding 0, set 0]] var params : SimParams; diff --git a/test/cube.wgsl b/test/cube.wgsl index 88dbd6451b..7ed1b2ca71 100644 --- a/test/cube.wgsl +++ b/test/cube.wgsl @@ -17,7 +17,7 @@ entry_point fragment = frag_main; # Vertex shader type Uniforms = [[block]] struct { - [[offset 0]] modelViewProjectionMatrix : mat4x4; + [[offset(0)]] modelViewProjectionMatrix : mat4x4; }; [[binding 0, set 0]] var uniforms : Uniforms;