Update align attribute to allow u32.
The WGSL spec has been updated to allow attributes to be i32 or u32. This CL updates the attribute support in Tint to follow. Bug: tint:1633 Change-Id: Ie6caa54f26a757c374c51c7d24e54d2a476f9c84 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103800 Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
dadb1fca0d
commit
f9f583bfe4
|
@ -692,7 +692,7 @@ TEST_F(StructMemberAttributeTest, Align_Attribute_ConstF32) {
|
||||||
Structure("mystruct", utils::Vector{Member(
|
Structure("mystruct", utils::Vector{Member(
|
||||||
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 value)");
|
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 or u32 value)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstU32) {
|
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstU32) {
|
||||||
|
@ -700,8 +700,7 @@ TEST_F(StructMemberAttributeTest, Align_Attribute_ConstU32) {
|
||||||
|
|
||||||
Structure("mystruct", utils::Vector{Member(
|
Structure("mystruct", utils::Vector{Member(
|
||||||
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_TRUE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 value)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstAInt) {
|
TEST_F(StructMemberAttributeTest, Align_Attribute_ConstAInt) {
|
||||||
|
@ -718,7 +717,7 @@ TEST_F(StructMemberAttributeTest, Align_Attribute_ConstAFloat) {
|
||||||
Structure("mystruct", utils::Vector{Member(
|
Structure("mystruct", utils::Vector{Member(
|
||||||
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 value)");
|
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 or u32 value)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StructMemberAttributeTest, Align_Attribute_Var) {
|
TEST_F(StructMemberAttributeTest, Align_Attribute_Var) {
|
||||||
|
@ -739,7 +738,7 @@ TEST_F(StructMemberAttributeTest, Align_Attribute_Override) {
|
||||||
Structure("mystruct", utils::Vector{Member(
|
Structure("mystruct", utils::Vector{Member(
|
||||||
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
"a", ty.f32(), utils::Vector{MemberAlign(Source{{12, 34}}, "val")})});
|
||||||
EXPECT_FALSE(r()->Resolve());
|
EXPECT_FALSE(r()->Resolve());
|
||||||
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 value)");
|
EXPECT_EQ(r()->error(), R"(12:34 error: 'align' must be an i32 or u32 value)");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace StructAndStructMemberTests
|
} // namespace StructAndStructMemberTests
|
||||||
|
|
|
@ -2821,8 +2821,8 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) {
|
||||||
if (!materialized) {
|
if (!materialized) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!materialized->Type()->Is<sem::I32>()) {
|
if (!materialized->Type()->IsAnyOf<sem::I32, sem::U32>()) {
|
||||||
AddError("'align' must be an i32 value", a->source);
|
AddError("'align' must be an i32 or u32 value", a->source);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue