Fixup utils::Vector merge conflicts.

This CL fixes various util::Vector calls that were needed after
the push constant CL landed.

Change-Id: I0a21ad61ece6327b8789c5c083f4d1fcfd6339b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98040
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-08-02 19:43:14 +00:00 committed by Dawn LUCI CQ
parent c2272b852e
commit ab5fc1c4dc
3 changed files with 26 additions and 19 deletions

View File

@ -471,7 +471,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantDisallowedWithoutEnable) {
TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithIgnoreStorageClassAttribute) { TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithIgnoreStorageClassAttribute) {
// var<push_constant> a : u32; // With ast::DisabledValidation::kIgnoreStorageClass // var<push_constant> a : u32; // With ast::DisabledValidation::kIgnoreStorageClass
GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant, GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant,
ast::AttributeList{Disable(ast::DisabledValidation::kIgnoreStorageClass)}); utils::Vector{Disable(ast::DisabledValidation::kIgnoreStorageClass)});
EXPECT_TRUE(r()->Resolve()); EXPECT_TRUE(r()->Resolve());
} }
@ -485,8 +485,9 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantOneVariableUsedInEntryPoint
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(ast::Extension::kChromiumExperimentalPushConstant);
GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant);
Func("main", {}, ty.void_(), {Assign(Phony(), "a")}, Func("main", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")},
{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))}); utils::Vector{Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_TRUE(r()->Resolve()); EXPECT_TRUE(r()->Resolve());
} }
@ -503,8 +504,10 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInEntryPoin
GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant);
GlobalVar(Source{{3, 4}}, "b", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar(Source{{3, 4}}, "b", ty.u32(), ast::StorageClass::kPushConstant);
Func(Source{{5, 6}}, "main", {}, ty.void_(), {Assign(Phony(), "a"), Assign(Phony(), "b")}, Func(Source{{5, 6}}, "main", {}, ty.void_(),
{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))}); utils::Vector{Assign(Phony(), "a"), Assign(Phony(), "b")},
utils::Vector{Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_FALSE(r()->Resolve()); EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), EXPECT_EQ(r()->error(),
@ -532,12 +535,13 @@ TEST_F(ResolverEntryPointValidationTest,
GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar(Source{{1, 2}}, "a", ty.u32(), ast::StorageClass::kPushConstant);
GlobalVar(Source{{3, 4}}, "b", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar(Source{{3, 4}}, "b", ty.u32(), ast::StorageClass::kPushConstant);
Func(Source{{5, 6}}, "uses_a", {}, ty.void_(), {Assign(Phony(), "a")}); Func(Source{{5, 6}}, "uses_a", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")});
Func(Source{{7, 8}}, "uses_b", {}, ty.void_(), {Assign(Phony(), "b")}); Func(Source{{7, 8}}, "uses_b", {}, ty.void_(), utils::Vector{Assign(Phony(), "b")});
Func(Source{{9, 10}}, "main", {}, ty.void_(), Func(Source{{9, 10}}, "main", {}, ty.void_(),
{CallStmt(Call("uses_a")), CallStmt(Call("uses_b"))}, utils::Vector{CallStmt(Call("uses_a")), CallStmt(Call("uses_b"))},
{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))}); utils::Vector{Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_FALSE(r()->Resolve()); EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), EXPECT_EQ(r()->error(),
@ -564,10 +568,12 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInDifferent
GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar("a", ty.u32(), ast::StorageClass::kPushConstant);
GlobalVar("b", ty.u32(), ast::StorageClass::kPushConstant); GlobalVar("b", ty.u32(), ast::StorageClass::kPushConstant);
Func("uses_a", {}, ty.void_(), {Assign(Phony(), "a")}, Func("uses_a", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")},
{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))}); utils::Vector{Stage(ast::PipelineStage::kCompute),
Func("uses_b", {}, ty.void_(), {Assign(Phony(), "b")}, create<ast::WorkgroupAttribute>(Expr(1_i))});
{Stage(ast::PipelineStage::kCompute), create<ast::WorkgroupAttribute>(Expr(1_i))}); Func("uses_b", {}, ty.void_(), utils::Vector{Assign(Phony(), "b")},
utils::Vector{Stage(ast::PipelineStage::kCompute),
create<ast::WorkgroupAttribute>(Expr(1_i))});
EXPECT_TRUE(r()->Resolve()); EXPECT_TRUE(r()->Resolve());
} }

View File

@ -548,9 +548,10 @@ TEST_F(ResolverStorageClassLayoutValidationTest, PushConstant_UnalignedMember) {
// }; // };
// var<push_constant> a : S; // var<push_constant> a : S;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(ast::Extension::kChromiumExperimentalPushConstant);
Structure(Source{{12, 34}}, "S", Structure(
{Member("a", ty.f32(), {MemberSize(5)}), Source{{12, 34}}, "S",
Member(Source{{34, 56}}, "b", ty.f32(), {MemberAlign(1)})}); utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5)}),
Member(Source{{34, 56}}, "b", ty.f32(), utils::Vector{MemberAlign(1)})});
GlobalVar(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kPushConstant); GlobalVar(Source{{78, 90}}, "a", ty.type_name("S"), ast::StorageClass::kPushConstant);
ASSERT_FALSE(r()->Resolve()); ASSERT_FALSE(r()->Resolve());
@ -574,8 +575,8 @@ TEST_F(ResolverStorageClassLayoutValidationTest, PushConstant_Aligned) {
// }; // };
// var<push_constant> a : S; // var<push_constant> a : S;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(ast::Extension::kChromiumExperimentalPushConstant);
Structure("S", Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5)}),
{Member("a", ty.f32(), {MemberSize(5)}), Member("b", ty.f32(), {MemberAlign(4)})}); Member("b", ty.f32(), utils::Vector{MemberAlign(4)})});
GlobalVar("a", ty.type_name("S"), ast::StorageClass::kPushConstant); GlobalVar("a", ty.type_name("S"), ast::StorageClass::kPushConstant);
ASSERT_TRUE(r()->Resolve()) << r()->error(); ASSERT_TRUE(r()->Resolve()) << r()->error();

View File

@ -663,7 +663,7 @@ TEST_F(ResolverStorageClassValidationTest, PushConstantArrayF32) {
// struct S { a : f32} // struct S { a : f32}
// var<push_constant> g : array<S, 3u>; // var<push_constant> g : array<S, 3u>;
Enable(ast::Extension::kChromiumExperimentalPushConstant); Enable(ast::Extension::kChromiumExperimentalPushConstant);
auto* s = Structure("S", {Member("a", ty.f32())}); auto* s = Structure("S", utils::Vector{Member("a", ty.f32())});
auto* a = ty.array(ty.Of(s), 3_u); auto* a = ty.array(ty.Of(s), 3_u);
GlobalVar("g", a, ast::StorageClass::kPushConstant); GlobalVar("g", a, ast::StorageClass::kPushConstant);