From 5aad70a06931614e6c8adc9a234a8ee4159f5abe Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Mon, 14 Dec 2020 21:10:07 +0000 Subject: [PATCH] Move all Source constructor params to be the first This consistency can be utilized by the ast::Builder to inject the source parameter if it isn't provided. Bug: tint:396 Bug: tint:390 Change-Id: I2f19002131e79daae799b8cbe918eb192d6bfc75 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35503 Commit-Queue: Ben Clayton Reviewed-by: dan sinclair --- src/ast/access_decoration.cc | 4 +- src/ast/access_decoration.h | 4 +- src/ast/binding_decoration.cc | 4 +- src/ast/binding_decoration.h | 2 +- src/ast/binding_decoration_test.cc | 6 +- src/ast/builtin_decoration.cc | 4 +- src/ast/builtin_decoration.h | 4 +- src/ast/builtin_decoration_test.cc | 6 +- src/ast/constant_id_decoration.cc | 4 +- src/ast/constant_id_decoration.h | 4 +- src/ast/constant_id_decoration_test.cc | 6 +- src/ast/decoration_test.cc | 6 +- src/ast/function_test.cc | 20 +-- src/ast/location_decoration.cc | 4 +- src/ast/location_decoration.h | 4 +- src/ast/location_decoration_test.cc | 6 +- src/ast/set_decoration.cc | 4 +- src/ast/set_decoration.h | 2 +- src/ast/set_decoration_test.cc | 6 +- src/ast/stage_decoration.cc | 4 +- src/ast/stage_decoration.h | 2 +- src/ast/stage_decoration_test.cc | 6 +- src/ast/stride_decoration.cc | 4 +- src/ast/stride_decoration.h | 2 +- src/ast/stride_decoration_test.cc | 6 +- src/ast/struct_member_offset_decoration.cc | 8 +- src/ast/struct_member_offset_decoration.h | 4 +- .../struct_member_offset_decoration_test.cc | 4 +- src/ast/struct_member_test.cc | 6 +- src/ast/type/access_control_type_test.cc | 16 +-- src/ast/type/alias_type_test.cc | 16 +-- src/ast/type/array_type_test.cc | 10 +- src/ast/type/struct_type_test.cc | 52 ++++---- src/ast/variable_test.cc | 12 +- src/ast/workgroup_decoration.cc | 18 +-- src/ast/workgroup_decoration.h | 12 +- src/ast/workgroup_decoration_test.cc | 10 +- src/inspector/inspector_test.cc | 120 +++++++++--------- src/reader/spirv/function.cc | 2 +- src/reader/spirv/parser_impl.cc | 16 +-- src/reader/wgsl/parser_impl.cc | 18 +-- src/transform/emit_vertex_point_size.cc | 2 +- src/transform/emit_vertex_point_size_test.cc | 16 +-- src/transform/first_index_offset.cc | 8 +- src/transform/first_index_offset_test.cc | 2 +- src/transform/vertex_pulling.cc | 12 +- src/transform/vertex_pulling_test.cc | 10 +- src/type_determiner_test.cc | 4 +- src/validator/validator_function_test.cc | 16 +-- src/validator/validator_test.cc | 4 +- src/validator/validator_type_test.cc | 2 +- .../hlsl/generator_impl_alias_type_test.cc | 2 +- ...tor_impl_function_entry_point_data_test.cc | 42 +++--- .../hlsl/generator_impl_function_test.cc | 110 ++++++++-------- .../generator_impl_member_accessor_test.cc | 108 ++++++++-------- .../generator_impl_module_constant_test.cc | 4 +- src/writer/hlsl/generator_impl_type_test.cc | 12 +- .../msl/generator_impl_alias_type_test.cc | 4 +- ...tor_impl_function_entry_point_data_test.cc | 42 +++--- .../msl/generator_impl_function_test.cc | 102 +++++++-------- .../generator_impl_module_constant_test.cc | 2 +- src/writer/msl/generator_impl_test.cc | 20 +-- src/writer/msl/generator_impl_type_test.cc | 12 +- ...rator_impl_variable_decl_statement_test.cc | 2 +- .../spirv/builder_function_decoration_test.cc | 20 +-- src/writer/spirv/builder_function_test.cc | 14 +- .../spirv/builder_global_variable_test.cc | 20 +-- src/writer/spirv/builder_type_test.cc | 18 +-- .../wgsl/generator_impl_alias_type_test.cc | 4 +- .../wgsl/generator_impl_function_test.cc | 22 ++-- src/writer/wgsl/generator_impl_type_test.cc | 12 +- .../wgsl/generator_impl_variable_test.cc | 12 +- 72 files changed, 554 insertions(+), 554 deletions(-) diff --git a/src/ast/access_decoration.cc b/src/ast/access_decoration.cc index 6d5e726c60..2346357741 100644 --- a/src/ast/access_decoration.cc +++ b/src/ast/access_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::AccessDecoration); namespace tint { namespace ast { -AccessDecoration::AccessDecoration(AccessControl val, const Source& source) +AccessDecoration::AccessDecoration(const Source& source, AccessControl val) : Base(source), value_(val) {} AccessDecoration::~AccessDecoration() = default; @@ -33,7 +33,7 @@ void AccessDecoration::to_str(std::ostream& out, size_t indent) const { } AccessDecoration* AccessDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(value_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), value_); } } // namespace ast diff --git a/src/ast/access_decoration.h b/src/ast/access_decoration.h index 07d437e66f..dcf2d950e2 100644 --- a/src/ast/access_decoration.h +++ b/src/ast/access_decoration.h @@ -27,9 +27,9 @@ namespace ast { class AccessDecoration : public Castable { public: /// constructor - /// @param value the access value /// @param source the source of this decoration - explicit AccessDecoration(AccessControl value, const Source& source); + /// @param value the access value + explicit AccessDecoration(const Source& source, AccessControl value); ~AccessDecoration() override; /// @returns the access control value diff --git a/src/ast/binding_decoration.cc b/src/ast/binding_decoration.cc index 127e6001ad..13d48d73ce 100644 --- a/src/ast/binding_decoration.cc +++ b/src/ast/binding_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::BindingDecoration); namespace tint { namespace ast { -BindingDecoration::BindingDecoration(uint32_t val, const Source& source) +BindingDecoration::BindingDecoration(const Source& source, uint32_t val) : Base(source), value_(val) {} BindingDecoration::~BindingDecoration() = default; @@ -33,7 +33,7 @@ void BindingDecoration::to_str(std::ostream& out, size_t indent) const { } BindingDecoration* BindingDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(value_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), value_); } } // namespace ast diff --git a/src/ast/binding_decoration.h b/src/ast/binding_decoration.h index 0299ddcbf6..ae4cc4504a 100644 --- a/src/ast/binding_decoration.h +++ b/src/ast/binding_decoration.h @@ -29,7 +29,7 @@ class BindingDecoration /// constructor /// @param value the binding value /// @param source the source of this decoration - BindingDecoration(uint32_t value, const Source& source); + BindingDecoration(const Source& source, uint32_t value); ~BindingDecoration() override; /// @returns the binding value diff --git a/src/ast/binding_decoration_test.cc b/src/ast/binding_decoration_test.cc index 54e6f7494b..58242360e6 100644 --- a/src/ast/binding_decoration_test.cc +++ b/src/ast/binding_decoration_test.cc @@ -24,12 +24,12 @@ namespace { using BindingDecorationTest = TestHelper; TEST_F(BindingDecorationTest, Creation) { - BindingDecoration d{2, Source{}}; + BindingDecoration d{Source{}, 2}; EXPECT_EQ(2u, d.value()); } TEST_F(BindingDecorationTest, Is) { - BindingDecoration bd{2, Source{}}; + BindingDecoration bd{Source{}, 2}; Decoration* d = &bd; EXPECT_TRUE(d->Is()); EXPECT_FALSE(d->Is()); @@ -39,7 +39,7 @@ TEST_F(BindingDecorationTest, Is) { } TEST_F(BindingDecorationTest, ToStr) { - BindingDecoration d{2, Source{}}; + BindingDecoration d{Source{}, 2}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(BindingDecoration{2} diff --git a/src/ast/builtin_decoration.cc b/src/ast/builtin_decoration.cc index 051761cdde..d7abdbee45 100644 --- a/src/ast/builtin_decoration.cc +++ b/src/ast/builtin_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::BuiltinDecoration); namespace tint { namespace ast { -BuiltinDecoration::BuiltinDecoration(Builtin builtin, const Source& source) +BuiltinDecoration::BuiltinDecoration(const Source& source, Builtin builtin) : Base(source), builtin_(builtin) {} BuiltinDecoration::~BuiltinDecoration() = default; @@ -33,7 +33,7 @@ void BuiltinDecoration::to_str(std::ostream& out, size_t indent) const { } BuiltinDecoration* BuiltinDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(builtin_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), builtin_); } } // namespace ast diff --git a/src/ast/builtin_decoration.h b/src/ast/builtin_decoration.h index c907f6975e..5a1419bee3 100644 --- a/src/ast/builtin_decoration.h +++ b/src/ast/builtin_decoration.h @@ -26,9 +26,9 @@ class BuiltinDecoration : public Castable { public: /// constructor - /// @param builtin the builtin value /// @param source the source of this decoration - BuiltinDecoration(Builtin builtin, const Source& source); + /// @param builtin the builtin value + BuiltinDecoration(const Source& source, Builtin builtin); ~BuiltinDecoration() override; /// @returns the builtin value diff --git a/src/ast/builtin_decoration_test.cc b/src/ast/builtin_decoration_test.cc index 3122651ff9..0618f652be 100644 --- a/src/ast/builtin_decoration_test.cc +++ b/src/ast/builtin_decoration_test.cc @@ -24,12 +24,12 @@ namespace { using BuiltinDecorationTest = TestHelper; TEST_F(BuiltinDecorationTest, Creation) { - BuiltinDecoration d{Builtin::kFragDepth, Source{}}; + BuiltinDecoration d{Source{}, Builtin::kFragDepth}; EXPECT_EQ(Builtin::kFragDepth, d.value()); } TEST_F(BuiltinDecorationTest, Is) { - BuiltinDecoration bd{Builtin::kFragDepth, Source{}}; + BuiltinDecoration bd{Source{}, Builtin::kFragDepth}; Decoration* d = &bd; EXPECT_FALSE(d->Is()); EXPECT_TRUE(d->Is()); @@ -39,7 +39,7 @@ TEST_F(BuiltinDecorationTest, Is) { } TEST_F(BuiltinDecorationTest, ToStr) { - BuiltinDecoration d{Builtin::kFragDepth, Source{}}; + BuiltinDecoration d{Source{}, Builtin::kFragDepth}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(BuiltinDecoration{frag_depth} diff --git a/src/ast/constant_id_decoration.cc b/src/ast/constant_id_decoration.cc index dbdd8ff3a4..840a30d38e 100644 --- a/src/ast/constant_id_decoration.cc +++ b/src/ast/constant_id_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::ConstantIdDecoration); namespace tint { namespace ast { -ConstantIdDecoration::ConstantIdDecoration(uint32_t val, const Source& source) +ConstantIdDecoration::ConstantIdDecoration(const Source& source, uint32_t val) : Base(source), value_(val) {} ConstantIdDecoration::~ConstantIdDecoration() = default; @@ -33,7 +33,7 @@ void ConstantIdDecoration::to_str(std::ostream& out, size_t indent) const { } ConstantIdDecoration* ConstantIdDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(value_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), value_); } } // namespace ast diff --git a/src/ast/constant_id_decoration.h b/src/ast/constant_id_decoration.h index d683e2ad60..bb990ae254 100644 --- a/src/ast/constant_id_decoration.h +++ b/src/ast/constant_id_decoration.h @@ -26,9 +26,9 @@ class ConstantIdDecoration : public Castable { public: /// constructor - /// @param val the constant_id value /// @param source the source of this decoration - ConstantIdDecoration(uint32_t val, const Source& source); + /// @param val the constant_id value + ConstantIdDecoration(const Source& source, uint32_t val); ~ConstantIdDecoration() override; /// @returns the constant id value diff --git a/src/ast/constant_id_decoration_test.cc b/src/ast/constant_id_decoration_test.cc index 28f77ee8cf..493c6da6b9 100644 --- a/src/ast/constant_id_decoration_test.cc +++ b/src/ast/constant_id_decoration_test.cc @@ -23,12 +23,12 @@ namespace { using ConstantIdDecorationTest = TestHelper; TEST_F(ConstantIdDecorationTest, Creation) { - ConstantIdDecoration d{12, Source{}}; + ConstantIdDecoration d{Source{}, 12}; EXPECT_EQ(12u, d.value()); } TEST_F(ConstantIdDecorationTest, Is) { - ConstantIdDecoration cd{27, Source{}}; + ConstantIdDecoration cd{Source{}, 27}; Decoration* d = &cd; EXPECT_FALSE(d->Is()); EXPECT_FALSE(d->Is()); @@ -38,7 +38,7 @@ TEST_F(ConstantIdDecorationTest, Is) { } TEST_F(ConstantIdDecorationTest, ToStr) { - ConstantIdDecoration d{1200, Source{}}; + ConstantIdDecoration d{Source{}, 1200}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(ConstantIdDecoration{1200} diff --git a/src/ast/decoration_test.cc b/src/ast/decoration_test.cc index f3feae864d..8ec0a01607 100644 --- a/src/ast/decoration_test.cc +++ b/src/ast/decoration_test.cc @@ -43,21 +43,21 @@ namespace { using DecorationTest = TestHelper; TEST_F(DecorationTest, AsCorrectType) { - auto* decoration = create(1, Source{}); + auto* decoration = create(Source{}, 1); auto* upcast = static_cast(decoration); auto* downcast = As(upcast); EXPECT_EQ(decoration, downcast); } TEST_F(DecorationTest, AsIncorrectType) { - auto* decoration = create(1, Source{}); + auto* decoration = create(Source{}, 1); auto* upcast = static_cast(decoration); auto* downcast = As(upcast); EXPECT_EQ(nullptr, downcast); } TEST_F(DecorationTest, Is) { - Decoration* decoration = create(1, Source{}); + Decoration* decoration = create(Source{}, 1); EXPECT_TRUE(decoration->Is()); EXPECT_FALSE(decoration->Is()); } diff --git a/src/ast/function_test.cc b/src/ast/function_test.cc index 546e9697a5..0d9f6455ba 100644 --- a/src/ast/function_test.cc +++ b/src/ast/function_test.cc @@ -107,25 +107,25 @@ TEST_F(FunctionTest, GetReferenceLocations) { auto* loc1 = create(Source{}, "loc1", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(0, Source{}), + create(Source{}, 0), }); auto* loc2 = create(Source{}, "loc2", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(1, Source{}), + create(Source{}, 1), }); auto* builtin1 = create( Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(Builtin::kPosition, Source{}), + create(Source{}, Builtin::kPosition), }); auto* builtin2 = create( Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(Builtin::kFragDepth, Source{}), + create(Source{}, Builtin::kFragDepth), }); Function f(Source{}, func_sym, "func", VariableList{}, &void_type, @@ -155,25 +155,25 @@ TEST_F(FunctionTest, GetReferenceBuiltins) { auto* loc1 = create(Source{}, "loc1", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(0, Source{}), + create(Source{}, 0), }); auto* loc2 = create(Source{}, "loc2", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(1, Source{}), + create(Source{}, 1), }); auto* builtin1 = create( Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(Builtin::kPosition, Source{}), + create(Source{}, Builtin::kPosition), }); auto* builtin2 = create( Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr, ast::VariableDecorationList{ - create(Builtin::kFragDepth, Source{}), + create(Source{}, Builtin::kFragDepth), }); Function f(Source{}, func_sym, "func", VariableList{}, &void_type, @@ -382,7 +382,7 @@ TEST_F(FunctionTest, ToStr_WithDecoration) { }); Function f( Source{}, func_sym, "func", {}, &void_type, body, - FunctionDecorationList{create(2, 4, 6, Source{})}); + FunctionDecorationList{create(Source{}, 2, 4, 6)}); std::ostringstream out; f.to_str(out, 2); @@ -512,7 +512,7 @@ TEST_F(FunctionTest, WorkgroupSize) { Function f(Source{}, func_sym, "func", {}, &void_type, create(Source{}, StatementList{}), - {create(2u, 4u, 6u, Source{})}); + {create(Source{}, 2u, 4u, 6u)}); uint32_t x = 0; uint32_t y = 0; diff --git a/src/ast/location_decoration.cc b/src/ast/location_decoration.cc index 64990a85f6..db28f0a1fe 100644 --- a/src/ast/location_decoration.cc +++ b/src/ast/location_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::LocationDecoration); namespace tint { namespace ast { -LocationDecoration::LocationDecoration(uint32_t val, const Source& source) +LocationDecoration::LocationDecoration(const Source& source, uint32_t val) : Base(source), value_(val) {} LocationDecoration::~LocationDecoration() = default; @@ -33,7 +33,7 @@ void LocationDecoration::to_str(std::ostream& out, size_t indent) const { } LocationDecoration* LocationDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(value_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), value_); } } // namespace ast diff --git a/src/ast/location_decoration.h b/src/ast/location_decoration.h index dc641e492d..f6583ea326 100644 --- a/src/ast/location_decoration.h +++ b/src/ast/location_decoration.h @@ -27,9 +27,9 @@ class LocationDecoration : public Castable { public: /// constructor - /// @param value the location value /// @param source the source of this decoration - LocationDecoration(uint32_t value, const Source& source); + /// @param value the location value + LocationDecoration(const Source& source, uint32_t value); ~LocationDecoration() override; /// @returns the location value diff --git a/src/ast/location_decoration_test.cc b/src/ast/location_decoration_test.cc index f402abe1fb..0e32216b74 100644 --- a/src/ast/location_decoration_test.cc +++ b/src/ast/location_decoration_test.cc @@ -26,12 +26,12 @@ namespace { using LocationDecorationTest = TestHelper; TEST_F(LocationDecorationTest, Creation) { - LocationDecoration d{2, Source{}}; + LocationDecoration d{Source{}, 2}; EXPECT_EQ(2u, d.value()); } TEST_F(LocationDecorationTest, Is) { - LocationDecoration ld{2, Source{}}; + LocationDecoration ld{Source{}, 2}; Decoration* d = &ld; EXPECT_FALSE(d->Is()); EXPECT_FALSE(d->Is()); @@ -41,7 +41,7 @@ TEST_F(LocationDecorationTest, Is) { } TEST_F(LocationDecorationTest, ToStr) { - LocationDecoration d{2, Source{}}; + LocationDecoration d{Source{}, 2}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(LocationDecoration{2} diff --git a/src/ast/set_decoration.cc b/src/ast/set_decoration.cc index 3b5ea5eb88..3f6607c7b5 100644 --- a/src/ast/set_decoration.cc +++ b/src/ast/set_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::SetDecoration); namespace tint { namespace ast { -SetDecoration::SetDecoration(uint32_t val, const Source& source) +SetDecoration::SetDecoration(const Source& source, uint32_t val) : Base(source), value_(val) {} SetDecoration::~SetDecoration() = default; @@ -33,7 +33,7 @@ void SetDecoration::to_str(std::ostream& out, size_t indent) const { } SetDecoration* SetDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(value_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), value_); } } // namespace ast diff --git a/src/ast/set_decoration.h b/src/ast/set_decoration.h index a58e334564..1ea07b2041 100644 --- a/src/ast/set_decoration.h +++ b/src/ast/set_decoration.h @@ -28,7 +28,7 @@ class SetDecoration : public Castable { /// constructor /// @param value the set value /// @param source the source of this decoration - SetDecoration(uint32_t value, const Source& source); + SetDecoration(const Source& source, uint32_t value); ~SetDecoration() override; /// @returns the set value diff --git a/src/ast/set_decoration_test.cc b/src/ast/set_decoration_test.cc index 088f3f078a..c0d6a15c43 100644 --- a/src/ast/set_decoration_test.cc +++ b/src/ast/set_decoration_test.cc @@ -24,12 +24,12 @@ namespace { using SetDecorationTest = TestHelper; TEST_F(SetDecorationTest, Creation) { - SetDecoration d{2, Source{}}; + SetDecoration d{Source{}, 2}; EXPECT_EQ(2u, d.value()); } TEST_F(SetDecorationTest, Is) { - SetDecoration sd{2, Source{}}; + SetDecoration sd{Source{}, 2}; Decoration* d = &sd; EXPECT_FALSE(d->Is()); EXPECT_FALSE(d->Is()); @@ -39,7 +39,7 @@ TEST_F(SetDecorationTest, Is) { } TEST_F(SetDecorationTest, ToStr) { - SetDecoration d{2, Source{}}; + SetDecoration d{Source{}, 2}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(SetDecoration{2} diff --git a/src/ast/stage_decoration.cc b/src/ast/stage_decoration.cc index d66817f464..50525f3e14 100644 --- a/src/ast/stage_decoration.cc +++ b/src/ast/stage_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StageDecoration); namespace tint { namespace ast { -StageDecoration::StageDecoration(PipelineStage stage, const Source& source) +StageDecoration::StageDecoration(const Source& source, PipelineStage stage) : Base(source), stage_(stage) {} StageDecoration::~StageDecoration() = default; @@ -33,7 +33,7 @@ void StageDecoration::to_str(std::ostream& out, size_t indent) const { } StageDecoration* StageDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(stage_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), stage_); } } // namespace ast diff --git a/src/ast/stage_decoration.h b/src/ast/stage_decoration.h index 4339f9899b..a8ee49ff5f 100644 --- a/src/ast/stage_decoration.h +++ b/src/ast/stage_decoration.h @@ -27,7 +27,7 @@ class StageDecoration : public Castable { /// constructor /// @param stage the pipeline stage /// @param source the source of this decoration - StageDecoration(PipelineStage stage, const Source& source); + StageDecoration(const Source& source, PipelineStage stage); ~StageDecoration() override; /// @returns the stage diff --git a/src/ast/stage_decoration_test.cc b/src/ast/stage_decoration_test.cc index 4bfdad94b7..966d7e0c1f 100644 --- a/src/ast/stage_decoration_test.cc +++ b/src/ast/stage_decoration_test.cc @@ -26,19 +26,19 @@ namespace { using StageDecorationTest = TestHelper; TEST_F(StageDecorationTest, Creation_1param) { - StageDecoration d{PipelineStage::kFragment, Source{}}; + StageDecoration d{Source{}, PipelineStage::kFragment}; EXPECT_EQ(d.value(), PipelineStage::kFragment); } TEST_F(StageDecorationTest, Is) { - StageDecoration sd{PipelineStage::kFragment, Source{}}; + StageDecoration sd{Source{}, PipelineStage::kFragment}; Decoration* d = &sd; EXPECT_FALSE(d->Is()); EXPECT_TRUE(d->Is()); } TEST_F(StageDecorationTest, ToStr) { - StageDecoration d{PipelineStage::kFragment, Source{}}; + StageDecoration d{Source{}, PipelineStage::kFragment}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(StageDecoration{fragment} diff --git a/src/ast/stride_decoration.cc b/src/ast/stride_decoration.cc index 094ec56fac..9e42cd750c 100644 --- a/src/ast/stride_decoration.cc +++ b/src/ast/stride_decoration.cc @@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StrideDecoration); namespace tint { namespace ast { -StrideDecoration::StrideDecoration(uint32_t stride, const Source& source) +StrideDecoration::StrideDecoration(const Source& source, uint32_t stride) : Base(source), stride_(stride) {} StrideDecoration::~StrideDecoration() = default; @@ -33,7 +33,7 @@ void StrideDecoration::to_str(std::ostream& out, size_t indent) const { } StrideDecoration* StrideDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(stride_, ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), stride_); } } // namespace ast diff --git a/src/ast/stride_decoration.h b/src/ast/stride_decoration.h index 317ac93e15..dc8997826e 100644 --- a/src/ast/stride_decoration.h +++ b/src/ast/stride_decoration.h @@ -28,7 +28,7 @@ class StrideDecoration : public Castable { /// constructor /// @param stride the stride value /// @param source the source of this decoration - StrideDecoration(uint32_t stride, const Source& source); + StrideDecoration(const Source& source, uint32_t stride); ~StrideDecoration() override; /// @returns the stride value diff --git a/src/ast/stride_decoration_test.cc b/src/ast/stride_decoration_test.cc index 6b9725585b..34a1079e81 100644 --- a/src/ast/stride_decoration_test.cc +++ b/src/ast/stride_decoration_test.cc @@ -23,18 +23,18 @@ namespace { using StrideDecorationTest = TestHelper; TEST_F(StrideDecorationTest, Creation) { - StrideDecoration d{2, Source{}}; + StrideDecoration d{Source{}, 2}; EXPECT_EQ(2u, d.stride()); } TEST_F(StrideDecorationTest, Is) { - StrideDecoration d{2, Source{}}; + StrideDecoration d{Source{}, 2}; EXPECT_TRUE(d.Is()); } TEST_F(StrideDecorationTest, Source) { StrideDecoration d{ - 2, Source{Source::Range{Source::Location{1, 2}, Source::Location{3, 4}}}}; + Source{Source::Range{Source::Location{1, 2}, Source::Location{3, 4}}}, 2}; EXPECT_EQ(d.source().range.begin.line, 1u); EXPECT_EQ(d.source().range.begin.column, 2u); EXPECT_EQ(d.source().range.end.line, 3u); diff --git a/src/ast/struct_member_offset_decoration.cc b/src/ast/struct_member_offset_decoration.cc index abd21619f9..4c3af19446 100644 --- a/src/ast/struct_member_offset_decoration.cc +++ b/src/ast/struct_member_offset_decoration.cc @@ -22,8 +22,8 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StructMemberOffsetDecoration); namespace tint { namespace ast { -StructMemberOffsetDecoration::StructMemberOffsetDecoration(uint32_t offset, - const Source& source) +StructMemberOffsetDecoration::StructMemberOffsetDecoration(const Source& source, + uint32_t offset) : Base(source), offset_(offset) {} StructMemberOffsetDecoration::~StructMemberOffsetDecoration() = default; @@ -36,8 +36,8 @@ void StructMemberOffsetDecoration::to_str(std::ostream& out, StructMemberOffsetDecoration* StructMemberOffsetDecoration::Clone( CloneContext* ctx) const { - return ctx->mod->create(offset_, - ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), + offset_); } } // namespace ast diff --git a/src/ast/struct_member_offset_decoration.h b/src/ast/struct_member_offset_decoration.h index a1537581dd..001d777ff8 100644 --- a/src/ast/struct_member_offset_decoration.h +++ b/src/ast/struct_member_offset_decoration.h @@ -27,9 +27,9 @@ class StructMemberOffsetDecoration : public Castable { public: /// constructor - /// @param offset the offset value /// @param source the source of this decoration - StructMemberOffsetDecoration(uint32_t offset, const Source& source); + /// @param offset the offset value + StructMemberOffsetDecoration(const Source& source, uint32_t offset); ~StructMemberOffsetDecoration() override; /// @returns the offset value diff --git a/src/ast/struct_member_offset_decoration_test.cc b/src/ast/struct_member_offset_decoration_test.cc index 2197f03f73..49a4796855 100644 --- a/src/ast/struct_member_offset_decoration_test.cc +++ b/src/ast/struct_member_offset_decoration_test.cc @@ -23,12 +23,12 @@ namespace { using StructMemberOffsetDecorationTest = TestHelper; TEST_F(StructMemberOffsetDecorationTest, Creation) { - StructMemberOffsetDecoration d{2, Source{}}; + StructMemberOffsetDecoration d{Source{}, 2}; EXPECT_EQ(2u, d.offset()); } TEST_F(StructMemberOffsetDecorationTest, Is) { - StructMemberOffsetDecoration d{2, Source{}}; + StructMemberOffsetDecoration d{Source{}, 2}; EXPECT_TRUE(d.Is()); } diff --git a/src/ast/struct_member_test.cc b/src/ast/struct_member_test.cc index e698302e24..1c9a6d7826 100644 --- a/src/ast/struct_member_test.cc +++ b/src/ast/struct_member_test.cc @@ -30,7 +30,7 @@ using StructMemberTest = TestHelper; TEST_F(StructMemberTest, Creation) { type::I32 i32; StructMemberDecorationList decorations; - decorations.emplace_back(create(4, Source{})); + decorations.emplace_back(create(Source{}, 4)); StructMember st{Source{}, "a", &i32, decorations}; EXPECT_EQ(st.name(), "a"); @@ -77,7 +77,7 @@ TEST_F(StructMemberTest, IsValid_NullType) { TEST_F(StructMemberTest, IsValid_Null_Decoration) { type::I32 i32; StructMemberDecorationList decorations; - decorations.emplace_back(create(4, Source{})); + decorations.emplace_back(create(Source{}, 4)); decorations.push_back(nullptr); StructMember st{Source{}, "a", &i32, decorations}; @@ -87,7 +87,7 @@ TEST_F(StructMemberTest, IsValid_Null_Decoration) { TEST_F(StructMemberTest, ToStr) { type::I32 i32; StructMemberDecorationList decorations; - decorations.emplace_back(create(4, Source{})); + decorations.emplace_back(create(Source{}, 4)); StructMember st{Source{}, "a", &i32, decorations}; std::ostringstream out; diff --git a/src/ast/type/access_control_type_test.cc b/src/ast/type/access_control_type_test.cc index 2927685ad3..ef803ac50f 100644 --- a/src/ast/type/access_control_type_test.cc +++ b/src/ast/type/access_control_type_test.cc @@ -107,7 +107,7 @@ TEST_F(AccessControlTest, MinBufferBindingSizeU32) { TEST_F(AccessControlTest, MinBufferBindingSizeArray) { U32 u32; Array array(&u32, 4, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); AccessControl at{ast::AccessControl::kReadOnly, &array}; EXPECT_EQ(16u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -115,7 +115,7 @@ TEST_F(AccessControlTest, MinBufferBindingSizeArray) { TEST_F(AccessControlTest, MinBufferBindingSizeRuntimeArray) { U32 u32; Array array(&u32, 0, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); AccessControl at{ast::AccessControl::kReadOnly, &array}; EXPECT_EQ(4u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } @@ -125,11 +125,11 @@ TEST_F(AccessControlTest, MinBufferBindingSizeStruct) { StructMemberList members; StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); deco = StructMemberDecorationList(); - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); StructDecorationList decos; @@ -150,7 +150,7 @@ TEST_F(AccessControlTest, BaseAlignmentU32) { TEST_F(AccessControlTest, BaseAlignmentArray) { U32 u32; Array array(&u32, 4, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); AccessControl at{ast::AccessControl::kReadOnly, &array}; EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer)); } @@ -158,7 +158,7 @@ TEST_F(AccessControlTest, BaseAlignmentArray) { TEST_F(AccessControlTest, BaseAlignmentRuntimeArray) { U32 u32; Array array(&u32, 0, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); AccessControl at{ast::AccessControl::kReadOnly, &array}; EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer)); } @@ -169,12 +169,12 @@ TEST_F(AccessControlTest, BaseAlignmentStruct) { { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; diff --git a/src/ast/type/alias_type_test.cc b/src/ast/type/alias_type_test.cc index 55bc94cfb1..dc34994240 100644 --- a/src/ast/type/alias_type_test.cc +++ b/src/ast/type/alias_type_test.cc @@ -175,7 +175,7 @@ TEST_F(AliasTest, MinBufferBindingSizeArray) { U32 u32; Array array(&u32, 4, ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); Alias alias{mod.RegisterSymbol("alias"), "alias", &array}; EXPECT_EQ(16u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); @@ -185,7 +185,7 @@ TEST_F(AliasTest, MinBufferBindingSizeRuntimeArray) { U32 u32; Array array(&u32, 0, ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); Alias alias{mod.RegisterSymbol("alias"), "alias", &array}; EXPECT_EQ(4u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); @@ -197,12 +197,12 @@ TEST_F(AliasTest, MinBufferBindingSizeStruct) { { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; @@ -224,7 +224,7 @@ TEST_F(AliasTest, BaseAlignmentArray) { U32 u32; Array array(&u32, 4, ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); Alias alias{mod.RegisterSymbol("alias"), "alias", &array}; EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer)); @@ -234,7 +234,7 @@ TEST_F(AliasTest, BaseAlignmentRuntimeArray) { U32 u32; Array array(&u32, 0, ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); Alias alias{mod.RegisterSymbol("alias"), "alias", &array}; EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer)); @@ -246,12 +246,12 @@ TEST_F(AliasTest, BaseAlignmentStruct) { { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; diff --git a/src/ast/type/array_type_test.cc b/src/ast/type/array_type_test.cc index 5d929fac7c..4de28df670 100644 --- a/src/ast/type/array_type_test.cc +++ b/src/ast/type/array_type_test.cc @@ -90,7 +90,7 @@ TEST_F(ArrayTest, TypeName_RuntimeArray) { TEST_F(ArrayTest, TypeName_WithStride) { I32 i32; Array arr{&i32, 3, - ArrayDecorationList{create(16, Source{})}}; + ArrayDecorationList{create(Source{}, 16)}}; EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16"); } @@ -103,21 +103,21 @@ TEST_F(ArrayTest, MinBufferBindingSizeNoStride) { TEST_F(ArrayTest, MinBufferBindingSizeArray) { U32 u32; Array arr(&u32, 4, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); EXPECT_EQ(16u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } TEST_F(ArrayTest, MinBufferBindingSizeRuntimeArray) { U32 u32; Array arr(&u32, 0, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); EXPECT_EQ(4u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer)); } TEST_F(ArrayTest, BaseAlignmentArray) { U32 u32; Array arr(&u32, 4, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer)); } @@ -125,7 +125,7 @@ TEST_F(ArrayTest, BaseAlignmentArray) { TEST_F(ArrayTest, BaseAlignmentRuntimeArray) { U32 u32; Array arr(&u32, 0, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer)); EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer)); } diff --git a/src/ast/type/struct_type_test.cc b/src/ast/type/struct_type_test.cc index 0a7b2d16f9..ad1131ba0b 100644 --- a/src/ast/type/struct_type_test.cc +++ b/src/ast/type/struct_type_test.cc @@ -83,12 +83,12 @@ TEST_F(StructTest, MinBufferBindingSize) { { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; @@ -103,22 +103,22 @@ TEST_F(StructTest, MinBufferBindingSize) { TEST_F(StructTest, MinBufferBindingSizeArray) { U32 u32; Array arr(&u32, 4, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(8, Source{})); + deco.push_back(create(Source{}, 8)); members.push_back(create(Source{}, "bar", &arr, deco)); } StructDecorationList decos; @@ -134,22 +134,22 @@ TEST_F(StructTest, MinBufferBindingSizeArray) { TEST_F(StructTest, MinBufferBindingSizeRuntimeArray) { U32 u32; Array arr(&u32, 0, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(8, Source{})); + deco.push_back(create(Source{}, 8)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; @@ -167,7 +167,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec2) { StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &vec2, deco)); } StructDecorationList decos; @@ -186,7 +186,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec3) { StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &vec3, deco)); } StructDecorationList decos; @@ -206,7 +206,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec4) { StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &vec4, deco)); } StructDecorationList decos; @@ -225,12 +225,12 @@ TEST_F(StructTest, BaseAlignment) { { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; @@ -244,22 +244,22 @@ TEST_F(StructTest, BaseAlignment) { TEST_F(StructTest, BaseAlignmentArray) { U32 u32; Array arr(&u32, 4, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(8, Source{})); + deco.push_back(create(Source{}, 8)); members.push_back(create(Source{}, "bar", &arr, deco)); } StructDecorationList decos; @@ -273,22 +273,22 @@ TEST_F(StructTest, BaseAlignmentArray) { TEST_F(StructTest, BaseAlignmentRuntimeArray) { U32 u32; Array arr(&u32, 0, - ArrayDecorationList{create(4, Source{})}); + ArrayDecorationList{create(Source{}, 4)}); StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(4, Source{})); + deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "bar", &u32, deco)); } { StructMemberDecorationList deco; - deco.push_back(create(8, Source{})); + deco.push_back(create(Source{}, 8)); members.push_back(create(Source{}, "bar", &u32, deco)); } StructDecorationList decos; @@ -305,7 +305,7 @@ TEST_F(StructTest, BaseAlignmentVec2) { StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &vec2, deco)); } StructDecorationList decos; @@ -323,7 +323,7 @@ TEST_F(StructTest, BaseAlignmentVec3) { StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &vec3, deco)); } StructDecorationList decos; @@ -341,7 +341,7 @@ TEST_F(StructTest, BaseAlignmentVec4) { StructMemberList members; { StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "foo", &vec4, deco)); } StructDecorationList decos; diff --git a/src/ast/variable_test.cc b/src/ast/variable_test.cc index 5fb2a261a4..778b4b7001 100644 --- a/src/ast/variable_test.cc +++ b/src/ast/variable_test.cc @@ -140,9 +140,9 @@ TEST_F(VariableTest, WithDecorations) { auto* var = create( Source{}, "my_var", StorageClass::kFunction, &t, false, nullptr, VariableDecorationList{ - create(1, Source{}), - create(Builtin::kPosition, Source{}), - create(1200, Source{}), + create(Source{}, 1), + create(Source{}, Builtin::kPosition), + create(Source{}, 1200), }); EXPECT_TRUE(var->HasLocationDecoration()); @@ -155,7 +155,7 @@ TEST_F(VariableTest, ConstantId) { auto* var = create(Source{}, "my_var", StorageClass::kFunction, &t, false, nullptr, VariableDecorationList{ - create(1200, Source{}), + create(Source{}, 1200), }); EXPECT_EQ(var->constant_id(), 1200u); @@ -168,8 +168,8 @@ TEST_F(VariableTest, Decorated_to_str) { create( Source{}, mod.RegisterSymbol("expr"), "expr"), VariableDecorationList{ - create(2, Source{}), - create(1, Source{}), + create(Source{}, 2), + create(Source{}, 1), }); std::ostringstream out; diff --git a/src/ast/workgroup_decoration.cc b/src/ast/workgroup_decoration.cc index b1935b9026..63fdf20b89 100644 --- a/src/ast/workgroup_decoration.cc +++ b/src/ast/workgroup_decoration.cc @@ -22,18 +22,18 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::WorkgroupDecoration); namespace tint { namespace ast { -WorkgroupDecoration::WorkgroupDecoration(uint32_t x, const Source& source) +WorkgroupDecoration::WorkgroupDecoration(const Source& source, uint32_t x) : Base(source), x_(x) {} -WorkgroupDecoration::WorkgroupDecoration(uint32_t x, - uint32_t y, - const Source& source) +WorkgroupDecoration::WorkgroupDecoration(const Source& source, + uint32_t x, + uint32_t y) : Base(source), x_(x), y_(y) {} -WorkgroupDecoration::WorkgroupDecoration(uint32_t x, +WorkgroupDecoration::WorkgroupDecoration(const Source& source, + uint32_t x, uint32_t y, - uint32_t z, - const Source& source) + uint32_t z) : Base(source), x_(x), y_(y), z_(z) {} WorkgroupDecoration::~WorkgroupDecoration() = default; @@ -45,8 +45,8 @@ void WorkgroupDecoration::to_str(std::ostream& out, size_t indent) const { } WorkgroupDecoration* WorkgroupDecoration::Clone(CloneContext* ctx) const { - return ctx->mod->create(x_, y_, z_, - ctx->Clone(source())); + return ctx->mod->create(ctx->Clone(source()), x_, y_, + z_); } } // namespace ast diff --git a/src/ast/workgroup_decoration.h b/src/ast/workgroup_decoration.h index ac16b416fe..9946108620 100644 --- a/src/ast/workgroup_decoration.h +++ b/src/ast/workgroup_decoration.h @@ -29,20 +29,20 @@ class WorkgroupDecoration : public Castable { public: /// constructor - /// @param x the workgroup x dimension size /// @param source the source of this decoration - WorkgroupDecoration(uint32_t x, const Source& source); + /// @param x the workgroup x dimension size + WorkgroupDecoration(const Source& source, uint32_t x); /// constructor + /// @param source the source of this decoration /// @param x the workgroup x dimension size /// @param y the workgroup x dimension size - /// @param source the source of this decoration - WorkgroupDecoration(uint32_t x, uint32_t y, const Source& source); + WorkgroupDecoration(const Source& source, uint32_t x, uint32_t y); /// constructor + /// @param source the source of this decoration /// @param x the workgroup x dimension size /// @param y the workgroup x dimension size /// @param z the workgroup x dimension size - /// @param source the source of this decoration - WorkgroupDecoration(uint32_t x, uint32_t y, uint32_t z, const Source& source); + WorkgroupDecoration(const Source& source, uint32_t x, uint32_t y, uint32_t z); ~WorkgroupDecoration() override; /// @returns the workgroup dimensions diff --git a/src/ast/workgroup_decoration_test.cc b/src/ast/workgroup_decoration_test.cc index e285d35ef8..b45dff8c6d 100644 --- a/src/ast/workgroup_decoration_test.cc +++ b/src/ast/workgroup_decoration_test.cc @@ -26,7 +26,7 @@ namespace { using WorkgroupDecorationTest = TestHelper; TEST_F(WorkgroupDecorationTest, Creation_1param) { - WorkgroupDecoration d{2, Source{}}; + WorkgroupDecoration d{Source{}, 2}; uint32_t x = 0; uint32_t y = 0; uint32_t z = 0; @@ -36,7 +36,7 @@ TEST_F(WorkgroupDecorationTest, Creation_1param) { EXPECT_EQ(z, 1u); } TEST_F(WorkgroupDecorationTest, Creation_2param) { - WorkgroupDecoration d{2, 4, Source{}}; + WorkgroupDecoration d{Source{}, 2, 4}; uint32_t x = 0; uint32_t y = 0; uint32_t z = 0; @@ -47,7 +47,7 @@ TEST_F(WorkgroupDecorationTest, Creation_2param) { } TEST_F(WorkgroupDecorationTest, Creation_3param) { - WorkgroupDecoration d{2, 4, 6, Source{}}; + WorkgroupDecoration d{Source{}, 2, 4, 6}; uint32_t x = 0; uint32_t y = 0; uint32_t z = 0; @@ -58,14 +58,14 @@ TEST_F(WorkgroupDecorationTest, Creation_3param) { } TEST_F(WorkgroupDecorationTest, Is) { - WorkgroupDecoration wd{2, 4, 6, Source{}}; + WorkgroupDecoration wd{Source{}, 2, 4, 6}; Decoration* d = &wd; EXPECT_TRUE(d->Is()); EXPECT_FALSE(d->Is()); } TEST_F(WorkgroupDecorationTest, ToStr) { - WorkgroupDecoration d{2, 4, 6, Source{}}; + WorkgroupDecoration d{Source{}, 2, 4, 6}; std::ostringstream out; d.to_str(out, 0); EXPECT_EQ(out.str(), R"(WorkgroupDecoration{2 4 6} diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc index d14992917d..192e7bdd73 100644 --- a/src/inspector/inspector_test.cc +++ b/src/inspector/inspector_test.cc @@ -231,7 +231,7 @@ class InspectorHelper { constructor, // constructor ast::VariableDecorationList{ // decorations - create(id, Source{}), + create(Source{}, id), }); mod()->AddGlobalVariable(var); } @@ -303,7 +303,7 @@ class InspectorHelper { ast::StructMemberDecorationList deco; deco.push_back( - create(offset, Source{})); + create(Source{}, offset)); members.push_back(create( Source{}, StructMemberName(members.size(), type), type, deco)); @@ -394,8 +394,8 @@ class InspectorHelper { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(binding, Source{}), - create(set, Source{}), + create(Source{}, binding), + create(Source{}, set), }); mod()->AddGlobalVariable(var); @@ -801,7 +801,7 @@ class InspectorHelper { array_type_memo_[count] = create( u32_type(), count, ast::ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); } return array_type_memo_[count]; @@ -915,7 +915,7 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) { auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -934,14 +934,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) { auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); auto* bar = MakeEmptyBodyFunction( "bar", ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod()->AddFunction(bar); @@ -966,14 +966,14 @@ TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) { auto* foo = MakeCallerBodyFunction( "foo", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); auto* bar = MakeCallerBodyFunction( "bar", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod()->AddFunction(bar); @@ -995,7 +995,7 @@ TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) { auto* foo = MakeCallerBodyFunction( "foo", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1014,8 +1014,8 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) { auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), - create(8u, 2u, 1u, Source{}), + create(Source{}, ast::PipelineStage::kCompute), + create(Source{}, 8u, 2u, 1u), }); mod()->AddFunction(foo); @@ -1037,7 +1037,7 @@ TEST_F(InspectorGetEntryPointTest, NoInOutVariables) { auto* foo = MakeCallerBodyFunction( "foo", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1055,7 +1055,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointInOutVariables) { auto* foo = MakeInOutVariableBodyFunction( "foo", {{"in_var", "out_var"}}, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1081,7 +1081,7 @@ TEST_F(InspectorGetEntryPointTest, FunctionInOutVariables) { auto* foo = MakeCallerBodyFunction( "foo", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1107,7 +1107,7 @@ TEST_F(InspectorGetEntryPointTest, RepeatedInOutVariables) { auto* foo = MakeInOutVariableCallerBodyFunction( "foo", "func", {{"in_var", "out_var"}}, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1130,7 +1130,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointMultipleInOutVariables) { auto* foo = MakeInOutVariableBodyFunction( "foo", {{"in_var", "out_var"}, {"in2_var", "out2_var"}}, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1159,7 +1159,7 @@ TEST_F(InspectorGetEntryPointTest, FunctionMultipleInOutVariables) { auto* foo = MakeCallerBodyFunction( "foo", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1184,14 +1184,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) { auto* foo = MakeInOutVariableBodyFunction( "foo", {{"in_var", "out2_var"}}, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); auto* bar = MakeInOutVariableBodyFunction( "bar", {{"in2_var", "out_var"}}, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod()->AddFunction(bar); @@ -1228,14 +1228,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsSharedInOutVariables) { auto* foo = MakeInOutVariableCallerBodyFunction( "foo", "func", {{"in_var", "out_var"}}, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); auto* bar = MakeCallerBodyFunction( "bar", "func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod()->AddFunction(bar); @@ -1291,7 +1291,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_OneEntryPoint) { auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1310,7 +1310,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -1319,7 +1319,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, auto* bar = MakeEmptyBodyFunction( "bar", ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod()->AddFunction(bar); @@ -1444,7 +1444,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "ub_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1458,7 +1458,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) { TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) { ast::StructMemberList members; ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create( Source{}, StructMemberName(members.size(), i32_type()), i32_type(), @@ -1479,7 +1479,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "ub_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1504,7 +1504,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "ub_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1533,7 +1533,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "ub_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1587,7 +1587,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) { Source{}, mod()->RegisterSymbol("ep_func"), "ep_func", ast::VariableList(), void_type(), body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -1624,7 +1624,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "ub_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1653,7 +1653,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1682,7 +1682,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1736,7 +1736,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) { Source{}, mod()->RegisterSymbol("ep_func"), "ep_func", ast::VariableList(), void_type(), body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -1773,7 +1773,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1802,7 +1802,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1831,7 +1831,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1856,7 +1856,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1912,7 +1912,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Source{}, mod()->RegisterSymbol("ep_func"), "ep_func", ast::VariableList(), void_type(), body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -1950,7 +1950,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -1981,7 +1981,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -2011,7 +2011,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "sb_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -2033,7 +2033,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) { auto* func = MakeSamplerReferenceBodyFunction( "ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2051,7 +2051,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) { auto* func = MakeEmptyBodyFunction( "ep_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2077,7 +2077,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "foo_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -2101,7 +2101,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) { auto* func = MakeSamplerReferenceBodyFunction( "ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2122,7 +2122,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) { auto* func = MakeComparisonSamplerReferenceBodyFunction( "ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2145,7 +2145,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) { auto* func = MakeComparisonSamplerReferenceBodyFunction( "ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2163,7 +2163,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) { auto* func = MakeEmptyBodyFunction( "ep_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2191,7 +2191,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) { auto* ep_func = MakeCallerBodyFunction( "ep_func", "foo_func", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(ep_func); @@ -2216,7 +2216,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) { auto* func = MakeComparisonSamplerReferenceBodyFunction( "ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2236,7 +2236,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) { auto* func = MakeSamplerReferenceBodyFunction( "ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2252,7 +2252,7 @@ TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) { auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -2275,7 +2275,7 @@ TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) { "ep", "foo_texture", "foo_sampler", "foo_coords", GetBaseType(GetParam().sampled_kind), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2359,7 +2359,7 @@ TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam, "ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index", GetBaseType(GetParam().sampled_kind), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2430,7 +2430,7 @@ TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam, "ep", "foo_texture", "foo_sampler", "foo_coords", GetBaseType(GetParam().sampled_kind), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -2479,7 +2479,7 @@ TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) { auto* foo = MakeEmptyBodyFunction( "foo", ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(foo); @@ -2504,7 +2504,7 @@ TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam, "ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index", GetBaseType(GetParam().sampled_kind), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index 82d9ec543d..c69911512d 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -906,7 +906,7 @@ bool FunctionEmitter::ParseFunctionDeclaration(FunctionDeclaration* decl) { } ast::FunctionDecorationList decos; if (ep_info_ != nullptr) { - decos.emplace_back(create(ep_info_->stage, Source{})); + decos.emplace_back(create(Source{}, ep_info_->stage)); } decl->name = name; diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc index 122ce2f28d..a75725f0a7 100644 --- a/src/reader/spirv/parser_impl.cc +++ b/src/reader/spirv/parser_impl.cc @@ -447,7 +447,7 @@ ast::StructMemberDecoration* ParserImpl::ConvertMemberDecoration( << ShowType(struct_type_id); return nullptr; } - return create(decoration[1], Source{}); + return create(Source{}, decoration[1]); case SpvDecorationNonReadable: // WGSL doesn't have a member decoration for this. Silently drop it. return nullptr; @@ -845,7 +845,7 @@ bool ParserImpl::ParseArrayDecorations( << ": multiple ArrayStride decorations"; } has_array_stride = true; - decorations->push_back(create(stride, Source{})); + decorations->push_back(create(Source{}, stride)); } else { return Fail() << "invalid array type ID " << type_id << ": unknown decoration " @@ -1072,7 +1072,7 @@ bool ParserImpl::EmitScalarSpecConstants() { ast::VariableDecorationList spec_id_decos; for (const auto& deco : GetDecorationsFor(inst.result_id())) { if ((deco.size() == 2) && (deco[0] == SpvDecorationSpecId)) { - auto* cid = create(deco[1], Source{}); + auto* cid = create(Source{}, deco[1]); spec_id_decos.push_back(cid); break; } @@ -1210,7 +1210,7 @@ bool ParserImpl::EmitModuleScopeVariables() { enum_converter_.ToStorageClass(builtin_position_.storage_class), ConvertType(builtin_position_.member_type_id), false, nullptr, ast::VariableDecorationList{ - create(ast::Builtin::kPosition, Source{}), + create(Source{}, ast::Builtin::kPosition), }); ast_module_.AddGlobalVariable(var); @@ -1255,7 +1255,7 @@ ast::Variable* ParserImpl::MakeVariable( return nullptr; } decorations.emplace_back( - create(ast_builtin, Source{})); + create(Source{}, ast_builtin)); } if (deco[0] == SpvDecorationLocation) { if (deco.size() != 2) { @@ -1264,7 +1264,7 @@ ast::Variable* ParserImpl::MakeVariable( return nullptr; } decorations.emplace_back( - create(deco[1], Source{})); + create(Source{}, deco[1])); } if (deco[0] == SpvDecorationDescriptorSet) { if (deco.size() == 1) { @@ -1272,7 +1272,7 @@ ast::Variable* ParserImpl::MakeVariable( << ": has no operand"; return nullptr; } - decorations.emplace_back(create(deco[1], Source{})); + decorations.emplace_back(create(Source{}, deco[1])); } if (deco[0] == SpvDecorationBinding) { if (deco.size() == 1) { @@ -1281,7 +1281,7 @@ ast::Variable* ParserImpl::MakeVariable( return nullptr; } decorations.emplace_back( - create(deco[1], Source{})); + create(Source{}, deco[1])); } } diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 663bdc6d45..e1d30619d3 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -2865,7 +2865,7 @@ Maybe ParserImpl::decoration() { if (val.errored) return Failure::kErrored; - return create(val.value, val.source); + return create(val.source, val.value); }); } @@ -2876,7 +2876,7 @@ Maybe ParserImpl::decoration() { if (val.errored) return Failure::kErrored; - return create(val.value, val.source); + return create(val.source, val.value); }); } @@ -2887,7 +2887,7 @@ Maybe ParserImpl::decoration() { if (val.errored) return Failure::kErrored; - return create(val.value, val.source); + return create(val.source, val.value); }); } @@ -2898,7 +2898,7 @@ Maybe ParserImpl::decoration() { if (val.errored) return Failure::kErrored; - return create(val.value, val.source); + return create(val.source, val.value); }); } @@ -2908,7 +2908,7 @@ Maybe ParserImpl::decoration() { if (builtin.errored) return Failure::kErrored; - return create(builtin.value, builtin.source); + return create(builtin.source, builtin.value); }); } @@ -2937,7 +2937,7 @@ Maybe ParserImpl::decoration() { } } - return create(x, y, z, t.source()); + return create(t.source(), x, y, z); }); } @@ -2947,7 +2947,7 @@ Maybe ParserImpl::decoration() { if (stage.errored) return Failure::kErrored; - return create(stage.value, stage.source); + return create(stage.source, stage.value); }); } @@ -2962,7 +2962,7 @@ Maybe ParserImpl::decoration() { if (val.errored) return Failure::kErrored; - return create(val.value, t.source()); + return create(t.source(), val.value); }); } @@ -2973,7 +2973,7 @@ Maybe ParserImpl::decoration() { if (val.errored) return Failure::kErrored; - return create(val.value, t.source()); + return create(t.source(), val.value); }); } diff --git a/src/transform/emit_vertex_point_size.cc b/src/transform/emit_vertex_point_size.cc index d8640d815c..c80fab76e2 100644 --- a/src/transform/emit_vertex_point_size.cc +++ b/src/transform/emit_vertex_point_size.cc @@ -66,7 +66,7 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) { ast::VariableDecorationList{ // decorations mod->create( - ast::Builtin::kPointSize, Source{}), + Source{}, ast::Builtin::kPointSize), }); mod->AddGlobalVariable(pointsize_var); diff --git a/src/transform/emit_vertex_point_size_test.cc b/src/transform/emit_vertex_point_size_test.cc index a089d3e596..95e64efbde 100644 --- a/src/transform/emit_vertex_point_size_test.cc +++ b/src/transform/emit_vertex_point_size_test.cc @@ -71,8 +71,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageBasic) { auto* entry = create( Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_, block, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, - Source{}), + create(Source{}, + ast::PipelineStage::kVertex), }); mod->AddFunction(entry); @@ -141,8 +141,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageEmpty) { Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, - Source{}), + create(Source{}, + ast::PipelineStage::kVertex), })); auto b_sym = mod->RegisterSymbol("non_entry_b"); @@ -197,8 +197,8 @@ TEST_F(EmitVertexPointSizeTest, NonVertexStage) { Source{}, frag_sym, "fragment_entry", ast::VariableList{}, ty.void_, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, - Source{}), + create(Source{}, + ast::PipelineStage::kFragment), }); mod->AddFunction(fragment_entry); @@ -207,8 +207,8 @@ TEST_F(EmitVertexPointSizeTest, NonVertexStage) { Source{}, comp_sym, "compute_entry", ast::VariableList{}, ty.void_, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod->AddFunction(compute_entry); } diff --git a/src/transform/first_index_offset.cc b/src/transform/first_index_offset.cc index 807a2c6924..b89b94f11e 100644 --- a/src/transform/first_index_offset.cc +++ b/src/transform/first_index_offset.cc @@ -197,7 +197,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) { if (has_vertex_index_) { ast::StructMemberDecorationList member_dec; member_dec.push_back( - mod->create(offset, Source{})); + mod->create(Source{}, offset)); members.push_back(mod->create( Source{}, kFirstVertexName, u32_type, std::move(member_dec))); vertex_index_offset_ = offset; @@ -207,7 +207,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) { if (has_instance_index_) { ast::StructMemberDecorationList member_dec; member_dec.push_back( - mod->create(offset, Source{})); + mod->create(Source{}, offset)); members.push_back(mod->create( Source{}, kFirstInstanceName, u32_type, std::move(member_dec))); instance_index_offset_ = offset; @@ -229,8 +229,8 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) { false, // is_const nullptr, // constructor ast::VariableDecorationList{ - mod->create(binding_, Source{}), - mod->create(set_, Source{}), + mod->create(Source{}, binding_), + mod->create(Source{}, set_), }); // decorations mod->AddGlobalVariable(idx_var); diff --git a/src/transform/first_index_offset_test.cc b/src/transform/first_index_offset_test.cc index 2e8164ada2..0717bdd679 100644 --- a/src/transform/first_index_offset_test.cc +++ b/src/transform/first_index_offset_test.cc @@ -54,7 +54,7 @@ struct ModuleBuilder : public ast::BuilderWithModule { void AddBuiltinInput(const std::string& name, ast::Builtin builtin) { mod->AddGlobalVariable( Var(name, ast::StorageClass::kInput, ty.u32, nullptr, - {create(builtin, Source{})})); + {create(Source{}, builtin)})); } ast::Function* AddFunction(const std::string& name, diff --git a/src/transform/vertex_pulling.cc b/src/transform/vertex_pulling.cc index 74feab3f5c..b1fa0449da 100644 --- a/src/transform/vertex_pulling.cc +++ b/src/transform/vertex_pulling.cc @@ -173,7 +173,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() { ast::VariableDecorationList{ // decorations out->create( - ast::Builtin::kVertexIdx, Source{}), + Source{}, ast::Builtin::kVertexIdx), }); out->AddGlobalVariable(var); @@ -220,7 +220,7 @@ void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() { ast::VariableDecorationList{ // decorations out->create( - ast::Builtin::kInstanceIdx, Source{}), + Source{}, ast::Builtin::kInstanceIdx), }); out->AddGlobalVariable(var); } @@ -258,14 +258,14 @@ void VertexPulling::State::AddVertexStorageBuffers() { auto* internal_array_type = out->create( GetU32Type(), 0, ast::ArrayDecorationList{ - out->create(4u, Source{}), + out->create(Source{}, 4u), }); // Creating the struct type ast::StructMemberList members; ast::StructMemberDecorationList member_dec; member_dec.push_back( - out->create(0u, Source{})); + out->create(Source{}, 0u)); members.push_back(out->create( Source{}, kStructBufferName, internal_array_type, std::move(member_dec))); @@ -288,8 +288,8 @@ void VertexPulling::State::AddVertexStorageBuffers() { nullptr, // constructor ast::VariableDecorationList{ // decorations - out->create(i, Source{}), - out->create(cfg.pulling_set, Source{}), + out->create(Source{}, i), + out->create(Source{}, cfg.pulling_set), }); out->AddGlobalVariable(var); } diff --git a/src/transform/vertex_pulling_test.cc b/src/transform/vertex_pulling_test.cc index 818853f356..65e644bbb9 100644 --- a/src/transform/vertex_pulling_test.cc +++ b/src/transform/vertex_pulling_test.cc @@ -51,7 +51,7 @@ class VertexPullingHelper { mod_->create(), create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{create( - ast::PipelineStage::kVertex, Source{})}); + Source{}, ast::PipelineStage::kVertex)}); mod()->AddFunction(func); } @@ -79,7 +79,7 @@ class VertexPullingHelper { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(location, Source{}), + create(Source{}, location), }); mod_->AddGlobalVariable(var); @@ -139,7 +139,7 @@ TEST_F(VertexPullingTest, Error_EntryPointWrongStage) { mod()->create(), create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod()->AddFunction(func); @@ -437,7 +437,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kVertexIdx, Source{}), + create(Source{}, ast::Builtin::kVertexIdx), })); mod()->AddGlobalVariable(create( @@ -449,7 +449,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kInstanceIdx, Source{}), + create(Source{}, ast::Builtin::kInstanceIdx), })); InitTransform( diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc index 36eb700471..c857083a4f 100644 --- a/src/type_determiner_test.cc +++ b/src/type_determiner_test.cc @@ -5338,7 +5338,7 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) { auto* ep_1 = create( Source{}, mod->RegisterSymbol("ep_1"), "ep_1", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); body = create( @@ -5356,7 +5356,7 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) { auto* ep_2 = create( Source{}, mod->RegisterSymbol("ep_2"), "ep_2", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod->AddFunction(func_b); diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc index 561caf58d5..94db436708 100644 --- a/src/validator/validator_function_test.cc +++ b/src/validator/validator_function_test.cc @@ -60,7 +60,7 @@ TEST_F(ValidateFunctionTest, VoidFunctionEndWithoutReturnStatement_Pass) { Source{Source::Location{12, 34}}, mod()->RegisterSymbol("func"), "func", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -79,7 +79,7 @@ TEST_F(ValidateFunctionTest, params, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -149,7 +149,7 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_Pass) { auto* func = create( Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -329,7 +329,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_NotVoid_Fail) { Source{Source::Location{12, 34}}, mod()->RegisterSymbol("vtx_main"), "vtx_main", params, &i32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -361,7 +361,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_WithParams_Fail) { Source{Source::Location{12, 34}}, mod()->RegisterSymbol("vtx_func"), "vtx_func", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -386,8 +386,8 @@ TEST_F(ValidateFunctionTest, PipelineStage_MustBeUnique_Fail) { Source{Source::Location{12, 34}}, mod()->RegisterSymbol("main"), "main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kVertex), + create(Source{}, ast::PipelineStage::kFragment), }); mod()->AddFunction(func); @@ -411,7 +411,7 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Pass) { Source{}, mod()->RegisterSymbol("vtx_func"), "vtx_func", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); diff --git a/src/validator/validator_test.cc b/src/validator/validator_test.cc index 876fb832b4..e6176074bb 100644 --- a/src/validator/validator_test.cc +++ b/src/validator/validator_test.cc @@ -398,7 +398,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) { Source{}, mod()->RegisterSymbol("my_func"), "my_func", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); @@ -848,7 +848,7 @@ TEST_F(ValidatorTest, RedeclaredIdentifierDifferentFunctions_Pass) { Source{}, mod()->RegisterSymbol("func1"), "func1", params1, &void_type, body1, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func0); diff --git a/src/validator/validator_type_test.cc b/src/validator/validator_type_test.cc index 4950b33ce5..46aaa96f8d 100644 --- a/src/validator/validator_type_test.cc +++ b/src/validator/validator_type_test.cc @@ -211,7 +211,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayInFunction_Fail) { auto* func = create( Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod()->AddFunction(func); diff --git a/src/writer/hlsl/generator_impl_alias_type_test.cc b/src/writer/hlsl/generator_impl_alias_type_test.cc index 9842bedf69..a0c53a700c 100644 --- a/src/writer/hlsl/generator_impl_alias_type_test.cc +++ b/src/writer/hlsl/generator_impl_alias_type_test.cc @@ -58,7 +58,7 @@ TEST_F(HlslGeneratorImplTest_Alias, EmitAlias_Struct) { create( Source{}, "b", &i32, ast::StructMemberDecorationList{ - create(4, Source{})}), + create(Source{}, 4)}), }, ast::StructDecorationList{}); diff --git a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc index d869cc0e7b..7a8236b29b 100644 --- a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc +++ b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc @@ -60,7 +60,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -100,7 +100,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod.AddFunction(func); @@ -139,7 +139,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -151,7 +151,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -180,7 +180,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod.AddFunction(func); @@ -219,7 +219,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -231,7 +231,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -260,7 +260,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod.AddFunction(func); @@ -299,7 +299,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -311,7 +311,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -339,7 +339,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -375,7 +375,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -387,7 +387,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -415,7 +415,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -446,7 +446,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -458,7 +458,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -486,7 +486,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -524,7 +524,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragCoord, Source{}), + create(Source{}, ast::Builtin::kFragCoord), }); auto* depth_var = create( @@ -536,7 +536,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(coord_var); @@ -562,7 +562,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc index 5668225609..60499bf34f 100644 --- a/src/writer/hlsl/generator_impl_function_test.cc +++ b/src/writer/hlsl/generator_impl_function_test.cc @@ -153,7 +153,7 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -165,7 +165,7 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -189,7 +189,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -228,7 +228,7 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragCoord, Source{}), + create(Source{}, ast::Builtin::kFragCoord), }); auto* depth_var = create( @@ -240,7 +240,7 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(coord_var); @@ -268,7 +268,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -307,8 +307,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -338,7 +338,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -381,8 +381,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); mod.AddConstructedType(&s); @@ -418,7 +418,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -447,11 +447,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -469,8 +469,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -500,7 +500,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -525,11 +525,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -547,8 +547,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -578,7 +578,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -603,11 +603,11 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -625,8 +625,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -653,7 +653,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", ast::VariableList{}, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -685,7 +685,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -697,7 +697,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); auto* val_var = @@ -709,7 +709,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); td.RegisterVariableForTesting(foo_var); @@ -776,7 +776,7 @@ TEST_F( auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -822,7 +822,7 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(depth_var); @@ -873,7 +873,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -913,7 +913,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragCoord, Source{}), + create(Source{}, ast::Builtin::kFragCoord), }); auto* depth_var = create( @@ -925,7 +925,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(coord_var); @@ -988,7 +988,7 @@ TEST_F( auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -1032,8 +1032,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -1095,7 +1095,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -1133,8 +1133,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -1196,7 +1196,7 @@ TEST_F(HlslGeneratorImplTest_Function, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -1232,7 +1232,7 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(bar_var); @@ -1268,7 +1268,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -1300,7 +1300,7 @@ TEST_F(HlslGeneratorImplTest_Function, ast::VariableList{}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -1325,7 +1325,7 @@ TEST_F(HlslGeneratorImplTest_Function, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -1353,8 +1353,8 @@ TEST_F(HlslGeneratorImplTest_Function, auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), - create(2u, 4u, 6u, Source{}), + create(Source{}, ast::PipelineStage::kCompute), + create(Source{}, 2u, 4u, 6u), }); mod.AddFunction(func); @@ -1427,7 +1427,7 @@ TEST_F(HlslGeneratorImplTest_Function, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "d", &f32, a_deco)); ast::StructDecorationList s_decos; @@ -1447,8 +1447,8 @@ TEST_F(HlslGeneratorImplTest_Function, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(0, Source{}), + create(Source{}, 0), + create(Source{}, 0), }); mod.AddConstructedType(&s); @@ -1480,8 +1480,8 @@ TEST_F(HlslGeneratorImplTest_Function, auto* func = create( Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -1512,8 +1512,8 @@ TEST_F(HlslGeneratorImplTest_Function, auto* func = create( Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod.AddFunction(func); diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc index 1f9d76d3fd..b8d2a8ef55 100644 --- a/src/writer/hlsl/generator_impl_member_accessor_test.cc +++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc @@ -50,7 +50,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) { ast::StructMemberList members; ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "mem", &f32, deco)); auto* strct = @@ -98,11 +98,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -152,11 +152,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -213,11 +213,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "z", &i32, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "a", &mat, ast::StructMemberDecorationList{ - create(4, Source{})}), + create(Source{}, 4)}), }, ast::StructDecorationList{}); @@ -288,11 +288,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "a", &mat, b_deco)); auto* str = @@ -353,11 +353,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "a", &mat, b_deco)); auto* str = @@ -414,11 +414,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "a", &mat, b_deco)); auto* str = @@ -471,7 +471,7 @@ TEST_F( ast::StructMemberList members; ast::StructMemberDecorationList deco; - deco.push_back(create(0, Source{})); + deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &mat, deco)); auto* str = @@ -524,11 +524,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "z", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(16, Source{})); + b_deco.push_back(create(Source{}, 16)); members.push_back(create(Source{}, "a", &mat, b_deco)); auto* str = @@ -584,12 +584,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::I32 i32; ast::type::Array ary(&i32, 5, ast::ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &ary, a_deco)); auto* str = @@ -641,12 +641,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::I32 i32; ast::type::Array ary(&i32, 5, ast::ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &ary, a_deco)); auto* str = @@ -709,11 +709,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -766,12 +766,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::I32 i32; ast::type::Array ary(&i32, 5, ast::ArrayDecorationList{ - create(4, Source{}), + create(Source{}, 4), }); ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &ary, a_deco)); auto* str = @@ -830,11 +830,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -891,11 +891,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &ivec3, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(16, Source{})); + b_deco.push_back(create(Source{}, 16)); members.push_back(create(Source{}, "b", &fvec3, b_deco)); auto* str = @@ -948,11 +948,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &ivec3, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(16, Source{})); + b_deco.push_back(create(Source{}, 16)); members.push_back(create(Source{}, "b", &fvec3, b_deco)); auto* str = @@ -1026,11 +1026,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "a", &ivec3, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "b", &fvec3, ast::StructMemberDecorationList{ - create(16, Source{})}), + create(Source{}, 16)}), }, ast::StructDecorationList{}); @@ -1038,7 +1038,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::Array ary(&data, 4, ast::ArrayDecorationList{ - create(32, Source{}), + create(Source{}, 32), }); auto* pre_str = create( @@ -1047,7 +1047,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "c", &ary, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), }, ast::StructDecorationList{}); @@ -1117,11 +1117,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "a", &ivec3, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "b", &fvec3, ast::StructMemberDecorationList{ - create(16, Source{})}), + create(Source{}, 16)}), }, ast::StructDecorationList{}); @@ -1129,14 +1129,14 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::Array ary( &data, 4, - ast::ArrayDecorationList{create(32, Source{})}); + ast::ArrayDecorationList{create(Source{}, 32)}); auto* pre_str = create( Source{}, ast::StructMemberList{create( Source{}, "c", &ary, ast::StructMemberDecorationList{ - create(0, Source{})})}, + create(Source{}, 0)})}, ast::StructDecorationList{}); ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str); @@ -1207,11 +1207,11 @@ TEST_F( create( Source{}, "a", &ivec3, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "b", &fvec3, ast::StructMemberDecorationList{ - create(16, Source{})}), + create(Source{}, 16)}), }, ast::StructDecorationList{}); @@ -1219,7 +1219,7 @@ TEST_F( ast::type::Array ary(&data, 4, ast::ArrayDecorationList{ - create(32, Source{}), + create(Source{}, 32), }); auto* pre_str = create( @@ -1227,7 +1227,7 @@ TEST_F( ast::StructMemberList{create( Source{}, "c", &ary, ast::StructMemberDecorationList{ - create(0, Source{})})}, + create(Source{}, 0)})}, ast::StructDecorationList{}); ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str); @@ -1297,11 +1297,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "a", &ivec3, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "b", &fvec3, ast::StructMemberDecorationList{ - create(16, Source{})}), + create(Source{}, 16)}), }, ast::StructDecorationList{}); @@ -1309,7 +1309,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::Array ary(&data, 4, ast::ArrayDecorationList{ - create(32, Source{}), + create(Source{}, 32), }); auto* pre_str = create( @@ -1317,7 +1317,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList{create( Source{}, "c", &ary, ast::StructMemberDecorationList{ - create(0, Source{})})}, + create(Source{}, 0)})}, ast::StructDecorationList{}); ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str); @@ -1387,11 +1387,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "a", &ivec3, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "b", &fvec3, ast::StructMemberDecorationList{ - create(16, Source{})}), + create(Source{}, 16)}), }, ast::StructDecorationList{}); @@ -1399,7 +1399,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::Array ary(&data, 4, ast::ArrayDecorationList{ - create(32, Source{}), + create(Source{}, 32), }); auto* pre_str = create( @@ -1407,7 +1407,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList{create( Source{}, "c", &ary, ast::StructMemberDecorationList{ - create(0, Source{})})}, + create(Source{}, 0)})}, ast::StructDecorationList{}); ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str); @@ -1487,11 +1487,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, create( Source{}, "a", &ivec3, ast::StructMemberDecorationList{ - create(0, Source{})}), + create(Source{}, 0)}), create( Source{}, "b", &fvec3, ast::StructMemberDecorationList{ - create(16, Source{})}), + create(Source{}, 16)}), }, ast::StructDecorationList{}); @@ -1499,7 +1499,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::type::Array ary(&data, 4, ast::ArrayDecorationList{ - create(32, Source{}), + create(Source{}, 32), }); auto* pre_str = create( @@ -1507,7 +1507,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, ast::StructMemberList{create( Source{}, "c", &ary, ast::StructMemberDecorationList{ - create(0, Source{})})}, + create(Source{}, 0)})}, ast::StructDecorationList{}); ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str); diff --git a/src/writer/hlsl/generator_impl_module_constant_test.cc b/src/writer/hlsl/generator_impl_module_constant_test.cc index bb2287bba9..401c6df2b4 100644 --- a/src/writer/hlsl/generator_impl_module_constant_test.cc +++ b/src/writer/hlsl/generator_impl_module_constant_test.cc @@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) { create(Source{}, &f32, 3.0f)), // constructor ast::VariableDecorationList{ // decorations - create(23, Source{}), + create(Source{}, 23), }); ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error(); @@ -96,7 +96,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoConstructor) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(23, Source{}), + create(Source{}, 23), }); ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error(); diff --git a/src/writer/hlsl/generator_impl_type_test.cc b/src/writer/hlsl/generator_impl_type_test.cc index 9ad6beb2bf..fdd19c8ee3 100644 --- a/src/writer/hlsl/generator_impl_type_test.cc +++ b/src/writer/hlsl/generator_impl_type_test.cc @@ -178,7 +178,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -203,7 +203,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -220,15 +220,15 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_InjectPadding) { ast::type::F32 f32; ast::StructMemberDecorationList decos; - decos.push_back(create(4, Source{})); + decos.push_back(create(Source{}, 4)); ast::StructMemberList members; members.push_back(create(Source{}, "a", &i32, decos)); - decos.push_back(create(32, Source{})); + decos.push_back(create(Source{}, 32)); members.push_back(create(Source{}, "b", &f32, decos)); - decos.push_back(create(128, Source{})); + decos.push_back(create(Source{}, 128)); members.push_back(create(Source{}, "c", &f32, decos)); auto* str = @@ -281,7 +281,7 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_WithDecoration) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); ast::StructDecorationList decos; diff --git a/src/writer/msl/generator_impl_alias_type_test.cc b/src/writer/msl/generator_impl_alias_type_test.cc index 1e886172ab..1726f1ce29 100644 --- a/src/writer/msl/generator_impl_alias_type_test.cc +++ b/src/writer/msl/generator_impl_alias_type_test.cc @@ -58,7 +58,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_Struct) { Source{}, "a", &f32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &i32, b_deco)); auto* str = @@ -83,7 +83,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_AliasStructIdent) { Source{}, "a", &f32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &i32, b_deco)); auto* str = diff --git a/src/writer/msl/generator_impl_function_entry_point_data_test.cc b/src/writer/msl/generator_impl_function_entry_point_data_test.cc index 49dd561900..d5b4535608 100644 --- a/src/writer/msl/generator_impl_function_entry_point_data_test.cc +++ b/src/writer/msl/generator_impl_function_entry_point_data_test.cc @@ -59,7 +59,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -71,7 +71,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -99,7 +99,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) { auto* func = create( Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod.AddFunction(func); @@ -136,7 +136,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -148,7 +148,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -176,7 +176,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) { auto* func = create( Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); mod.AddFunction(func); @@ -213,7 +213,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -225,7 +225,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -253,7 +253,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) { auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -290,7 +290,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -302,7 +302,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -330,7 +330,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) { auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -364,7 +364,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -376,7 +376,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -404,7 +404,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) { auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -433,7 +433,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -445,7 +445,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -473,7 +473,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) { auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -508,7 +508,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragCoord, Source{}), + create(Source{}, ast::Builtin::kFragCoord), }); auto* depth_var = create( @@ -520,7 +520,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(coord_var); @@ -547,7 +547,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) { auto* func = create( Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc index c328b9eb83..3b003c95a1 100644 --- a/src/writer/msl/generator_impl_function_test.cc +++ b/src/writer/msl/generator_impl_function_test.cc @@ -164,7 +164,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -176,7 +176,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(foo_var); @@ -200,7 +200,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) { Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{create( - ast::PipelineStage::kFragment, Source{})}); + Source{}, ast::PipelineStage::kFragment)}); mod.AddFunction(func); @@ -241,7 +241,7 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragCoord, Source{}), + create(Source{}, ast::Builtin::kFragCoord), }); auto* depth_var = create( @@ -253,7 +253,7 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(coord_var); @@ -281,7 +281,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -318,8 +318,8 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -350,7 +350,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) { Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -376,11 +376,11 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -400,8 +400,8 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -432,7 +432,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -462,11 +462,11 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -486,8 +486,8 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -519,7 +519,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -557,7 +557,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); auto* bar_var = @@ -569,7 +569,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); auto* val_var = @@ -581,7 +581,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); td.RegisterVariableForTesting(foo_var); @@ -648,7 +648,7 @@ TEST_F( auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -697,7 +697,7 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(depth_var); @@ -749,7 +749,7 @@ TEST_F(MslGeneratorImplTest, auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -792,7 +792,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragCoord, Source{}), + create(Source{}, ast::Builtin::kFragCoord), }); auto* depth_var = create( @@ -804,7 +804,7 @@ TEST_F( nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kFragDepth, Source{}), + create(Source{}, ast::Builtin::kFragDepth), }); td.RegisterVariableForTesting(coord_var); @@ -867,7 +867,7 @@ TEST_F( auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -909,8 +909,8 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -971,7 +971,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -1000,11 +1000,11 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -1024,8 +1024,8 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -1085,7 +1085,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -1120,11 +1120,11 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "a", &i32, a_deco)); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -1144,8 +1144,8 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(1, Source{}), + create(Source{}, 0), + create(Source{}, 1), }); td.RegisterVariableForTesting(coord_var); @@ -1205,7 +1205,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func); @@ -1247,7 +1247,7 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1, Source{}), + create(Source{}, 1), }); td.RegisterVariableForTesting(bar_var); @@ -1283,7 +1283,7 @@ TEST_F(MslGeneratorImplTest, auto* func_1 = create( Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); mod.AddFunction(func_1); @@ -1316,7 +1316,7 @@ TEST_F(MslGeneratorImplTest, Source{}, mod.RegisterSymbol("main"), "main", ast::VariableList{}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -1392,7 +1392,7 @@ TEST_F(MslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "d", &f32, a_deco)); ast::StructDecorationList s_decos; @@ -1412,8 +1412,8 @@ TEST_F(MslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(0, Source{}), + create(Source{}, 0), + create(Source{}, 0), }); mod.AddConstructedType(&s); @@ -1445,8 +1445,8 @@ TEST_F(MslGeneratorImplTest, auto* func = create( Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -1476,8 +1476,8 @@ TEST_F(MslGeneratorImplTest, auto* func = create( Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod.AddFunction(func); diff --git a/src/writer/msl/generator_impl_module_constant_test.cc b/src/writer/msl/generator_impl_module_constant_test.cc index 80756e3af4..44e39d20fb 100644 --- a/src/writer/msl/generator_impl_module_constant_test.cc +++ b/src/writer/msl/generator_impl_module_constant_test.cc @@ -74,7 +74,7 @@ TEST_F(MslGeneratorImplTest, Emit_SpecConstant) { create(Source{}, &f32, 3.0f)), // constructor ast::VariableDecorationList{ // decorations - create(23, Source{}), + create(Source{}, 23), }); ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error(); diff --git a/src/writer/msl/generator_impl_test.cc b/src/writer/msl/generator_impl_test.cc index 72e0cd316a..861473a386 100644 --- a/src/writer/msl/generator_impl_test.cc +++ b/src/writer/msl/generator_impl_test.cc @@ -54,7 +54,7 @@ TEST_F(MslGeneratorImplTest, Generate) { Source{}, mod.RegisterSymbol("my_func"), "my_func", ast::VariableList{}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -160,15 +160,15 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct) { ast::type::F32 f32; ast::StructMemberDecorationList decos; - decos.push_back(create(4, Source{})); + decos.push_back(create(Source{}, 4)); ast::StructMemberList members; members.push_back(create(Source{}, "a", &i32, decos)); - decos.push_back(create(32, Source{})); + decos.push_back(create(Source{}, 32)); members.push_back(create(Source{}, "b", &f32, decos)); - decos.push_back(create(128, Source{})); + decos.push_back(create(Source{}, 128)); members.push_back(create(Source{}, "c", &f32, decos)); auto* str = @@ -185,15 +185,15 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) { ast::type::Vector fvec(&f32, 3); ast::StructMemberDecorationList decos; - decos.push_back(create(0, Source{})); + decos.push_back(create(Source{}, 0)); ast::StructMemberList members; members.push_back(create(Source{}, "a", &i32, decos)); - decos.push_back(create(16, Source{})); + decos.push_back(create(Source{}, 16)); members.push_back(create(Source{}, "b", &fvec, decos)); - decos.push_back(create(32, Source{})); + decos.push_back(create(Source{}, 32)); members.push_back(create(Source{}, "c", &f32, decos)); auto* inner_str = @@ -201,13 +201,13 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) { ast::type::Struct inner_s(mod.RegisterSymbol("Inner"), "Inner", inner_str); - decos.push_back(create(0, Source{})); + decos.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "d", &f32, decos)); - decos.push_back(create(32, Source{})); + decos.push_back(create(Source{}, 32)); members.push_back(create(Source{}, "e", &inner_s, decos)); - decos.push_back(create(64, Source{})); + decos.push_back(create(Source{}, 64)); members.push_back(create(Source{}, "f", &f32, decos)); auto* outer_str = diff --git a/src/writer/msl/generator_impl_type_test.cc b/src/writer/msl/generator_impl_type_test.cc index b3725188ac..07321f5b9d 100644 --- a/src/writer/msl/generator_impl_type_test.cc +++ b/src/writer/msl/generator_impl_type_test.cc @@ -179,7 +179,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -200,7 +200,7 @@ TEST_F(MslGeneratorImplTest, EmitType_StructDecl) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -226,15 +226,15 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_InjectPadding) { create( Source{}, "a", &i32, ast::StructMemberDecorationList{ - create(4, Source{})}), + create(Source{}, 4)}), create( Source{}, "b", &f32, ast::StructMemberDecorationList{ - create(32, Source{})}), + create(Source{}, 32)}), create( Source{}, "c", &f32, ast::StructMemberDecorationList{ - create(128, Source{})}), + create(Source{}, 128)}), }, ast::StructDecorationList{}); @@ -286,7 +286,7 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); ast::StructDecorationList decos; diff --git a/src/writer/msl/generator_impl_variable_decl_statement_test.cc b/src/writer/msl/generator_impl_variable_decl_statement_test.cc index c575744a8d..1027d1044b 100644 --- a/src/writer/msl/generator_impl_variable_decl_statement_test.cc +++ b/src/writer/msl/generator_impl_variable_decl_statement_test.cc @@ -107,7 +107,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) { Source{}, "a", &f32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = diff --git a/src/writer/spirv/builder_function_decoration_test.cc b/src/writer/spirv/builder_function_decoration_test.cc index 6ca5f03313..fe8fc51e55 100644 --- a/src/writer/spirv/builder_function_decoration_test.cc +++ b/src/writer/spirv/builder_function_decoration_test.cc @@ -45,7 +45,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage) { Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); ASSERT_TRUE(b.GenerateFunction(&func)) << b.error(); @@ -72,7 +72,7 @@ TEST_P(FunctionDecoration_StageTest, Emit) { Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(params.stage, Source{}), + create(Source{}, params.stage), }); ASSERT_TRUE(b.GenerateFunction(&func)) << b.error(); @@ -102,7 +102,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUnusedInterfaceIds) { Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); auto* v_in = @@ -191,7 +191,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUsedInterfaceIds) { ast::Function func( Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kVertex, Source{}), + create(Source{}, ast::PipelineStage::kVertex), }); auto* v_in = @@ -262,7 +262,7 @@ TEST_F(BuilderTest, FunctionDecoration_ExecutionMode_Fragment_OriginUpperLeft) { Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error(); @@ -278,7 +278,7 @@ TEST_F(BuilderTest, FunctionDecoration_WorkgroupSize_Default) { Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, ast::PipelineStage::kCompute), }); ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error(); @@ -294,8 +294,8 @@ TEST_F(BuilderTest, FunctionDecoration_WorkgroupSize) { Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(2u, 4u, 6u, Source{}), - create(ast::PipelineStage::kCompute, Source{}), + create(Source{}, 2u, 4u, 6u), + create(Source{}, ast::PipelineStage::kCompute), }); ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error(); @@ -311,14 +311,14 @@ TEST_F(BuilderTest, FunctionDecoration_ExecutionMode_MultipleFragment) { Source{}, mod->RegisterSymbol("main1"), "main1", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); ast::Function func2( Source{}, mod->RegisterSymbol("main2"), "main2", {}, &void_type, create(Source{}, ast::StatementList{}), ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); ASSERT_TRUE(b.GenerateFunction(&func1)) << b.error(); diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc index c386df2c8a..4564a6b579 100644 --- a/src/writer/spirv/builder_function_test.cc +++ b/src/writer/spirv/builder_function_test.cc @@ -274,7 +274,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "d", &f32, a_deco)); ast::StructDecorationList s_decos; @@ -294,8 +294,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(0, Source{}), + create(Source{}, 0), + create(Source{}, 0), }); mod->AddConstructedType(&s); @@ -328,8 +328,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { auto* func = create( Source{}, mod->RegisterSymbol("a"), "a", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod->AddFunction(func); @@ -360,8 +360,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) { auto* func = create( Source{}, mod->RegisterSymbol("b"), "b", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod->AddFunction(func); diff --git a/src/writer/spirv/builder_global_variable_test.cc b/src/writer/spirv/builder_global_variable_test.cc index 86d8f19785..9a5b495b4f 100644 --- a/src/writer/spirv/builder_global_variable_test.cc +++ b/src/writer/spirv/builder_global_variable_test.cc @@ -251,7 +251,7 @@ TEST_F(BuilderTest, GlobalVar_WithLocation) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(5, Source{}), + create(Source{}, 5), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -277,8 +277,8 @@ TEST_F(BuilderTest, GlobalVar_WithBindingAndSet) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(2, Source{}), - create(3, Source{}), + create(Source{}, 2), + create(Source{}, 3), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -305,7 +305,7 @@ TEST_F(BuilderTest, GlobalVar_WithBuiltin) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(ast::Builtin::kPosition, Source{}), + create(Source{}, ast::Builtin::kPosition), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -334,7 +334,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Bool) { create(Source{}, &bool_type, true)), // constructor ast::VariableDecorationList{ // decorations - create(1200, Source{}), + create(Source{}, 1200), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -361,7 +361,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Bool_NoConstructor) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(1200, Source{}), + create(Source{}, 1200), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -390,7 +390,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar) { create(Source{}, &f32, 2.0)), // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -417,7 +417,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_F32_NoConstructor) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -444,7 +444,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_I32_NoConstructor) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); @@ -471,7 +471,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_U32_NoConstructor) { nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), + create(Source{}, 0), }); EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error(); diff --git a/src/writer/spirv/builder_type_test.cc b/src/writer/spirv/builder_type_test.cc index 2ed7ffb3f0..23908264cd 100644 --- a/src/writer/spirv/builder_type_test.cc +++ b/src/writer/spirv/builder_type_test.cc @@ -125,7 +125,7 @@ TEST_F(BuilderTest_Type, GenerateArray_WithStride) { ast::type::Array ary(&i32, 4, ast::ArrayDecorationList{ - create(16u, Source{}), + create(Source{}, 16u), }); auto id = b.GenerateTypeIfNeeded(&ary); @@ -346,9 +346,9 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) { ast::type::F32 f32; ast::StructMemberDecorationList a_decos; - a_decos.push_back(create(0, Source{})); + a_decos.push_back(create(Source{}, 0)); ast::StructMemberDecorationList b_decos; - b_decos.push_back(create(8, Source{})); + b_decos.push_back(create(Source{}, 8)); ast::StructMemberList members; members.push_back(create(Source{}, "a", &f32, a_decos)); @@ -423,11 +423,11 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutMatrix) { ast::type::Matrix glsl_mat4x4(&f32, 4, 4); ast::StructMemberDecorationList a_decos; - a_decos.push_back(create(0, Source{})); + a_decos.push_back(create(Source{}, 0)); ast::StructMemberDecorationList b_decos; - b_decos.push_back(create(16, Source{})); + b_decos.push_back(create(Source{}, 16)); ast::StructMemberDecorationList c_decos; - c_decos.push_back(create(48, Source{})); + c_decos.push_back(create(Source{}, 48)); ast::StructMemberList members; members.push_back( @@ -490,11 +490,11 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutArraysOfMatrix) { ast::ArrayDecorationList{}); // Runtime array ast::StructMemberDecorationList a_decos; - a_decos.push_back(create(0, Source{})); + a_decos.push_back(create(Source{}, 0)); ast::StructMemberDecorationList b_decos; - b_decos.push_back(create(16, Source{})); + b_decos.push_back(create(Source{}, 16)); ast::StructMemberDecorationList c_decos; - c_decos.push_back(create(48, Source{})); + c_decos.push_back(create(Source{}, 48)); ast::StructMemberList members; members.push_back( diff --git a/src/writer/wgsl/generator_impl_alias_type_test.cc b/src/writer/wgsl/generator_impl_alias_type_test.cc index 7a4da55299..1bbc96bf63 100644 --- a/src/writer/wgsl/generator_impl_alias_type_test.cc +++ b/src/writer/wgsl/generator_impl_alias_type_test.cc @@ -48,7 +48,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) { Source{}, "a", &f32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &i32, b_deco)); auto* str = @@ -77,7 +77,7 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_ToStruct) { Source{}, "a", &f32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &i32, b_deco)); auto* str = diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc index 061a623515..9909f45c32 100644 --- a/src/writer/wgsl/generator_impl_function_test.cc +++ b/src/writer/wgsl/generator_impl_function_test.cc @@ -110,7 +110,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_WorkgroupSize) { ast::Function func(Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body, ast::FunctionDecorationList{ - create(2u, 4u, 6u, Source{}), + create(Source{}, 2u, 4u, 6u), }); gen.increment_indent(); @@ -134,7 +134,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Stage) { ast::Function func( Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), + create(Source{}, ast::PipelineStage::kFragment), }); gen.increment_indent(); @@ -158,8 +158,8 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Multiple) { ast::Function func( Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kFragment, Source{}), - create(2u, 4u, 6u, Source{}), + create(Source{}, ast::PipelineStage::kFragment), + create(Source{}, 2u, 4u, 6u), }); gen.increment_indent(); @@ -197,7 +197,7 @@ TEST_F(WgslGeneratorImplTest, ast::StructMemberList members; ast::StructMemberDecorationList a_deco; - a_deco.push_back(create(0, Source{})); + a_deco.push_back(create(Source{}, 0)); members.push_back(create(Source{}, "d", &f32, a_deco)); ast::StructDecorationList s_decos; @@ -217,8 +217,8 @@ TEST_F(WgslGeneratorImplTest, nullptr, // constructor ast::VariableDecorationList{ // decorations - create(0, Source{}), - create(0, Source{}), + create(Source{}, 0), + create(Source{}, 0), }); mod.AddConstructedType(&s); @@ -250,8 +250,8 @@ TEST_F(WgslGeneratorImplTest, auto* func = create( Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod.AddFunction(func); @@ -281,8 +281,8 @@ TEST_F(WgslGeneratorImplTest, auto* func = create( Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body, ast::FunctionDecorationList{ - create(ast::PipelineStage::kCompute, - Source{}), + create(Source{}, + ast::PipelineStage::kCompute), }); mod.AddFunction(func); diff --git a/src/writer/wgsl/generator_impl_type_test.cc b/src/writer/wgsl/generator_impl_type_test.cc index 32dbf55f3b..ff533a8e94 100644 --- a/src/writer/wgsl/generator_impl_type_test.cc +++ b/src/writer/wgsl/generator_impl_type_test.cc @@ -107,7 +107,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) { ast::type::Bool b; ast::type::Array a(&b, 4, ast::ArrayDecorationList{ - create(16u, Source{}), + create(Source{}, 16u), }); ASSERT_TRUE(gen.EmitType(&a)) << gen.error(); @@ -118,8 +118,8 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_MultipleDecorations) { ast::type::Bool b; ast::type::Array a(&b, 4, ast::ArrayDecorationList{ - create(16u, Source{}), - create(32u, Source{}), + create(Source{}, 16u), + create(Source{}, 32u), }); ASSERT_TRUE(gen.EmitType(&a)) << gen.error(); @@ -180,7 +180,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -201,7 +201,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructDecl) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); auto* str = @@ -227,7 +227,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithDecoration) { Source{}, "a", &i32, ast::StructMemberDecorationList{})); ast::StructMemberDecorationList b_deco; - b_deco.push_back(create(4, Source{})); + b_deco.push_back(create(Source{}, 4)); members.push_back(create(Source{}, "b", &f32, b_deco)); ast::StructDecorationList decos; diff --git a/src/writer/wgsl/generator_impl_variable_test.cc b/src/writer/wgsl/generator_impl_variable_test.cc index 6583725406..3c9878cc95 100644 --- a/src/writer/wgsl/generator_impl_variable_test.cc +++ b/src/writer/wgsl/generator_impl_variable_test.cc @@ -58,7 +58,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) { ast::Variable v(Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr, ast::VariableDecorationList{ - create(2, Source{}), + create(Source{}, 2), }); ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error(); @@ -72,11 +72,11 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated_Multiple) { ast::Variable v( Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr, ast::VariableDecorationList{ - create(ast::Builtin::kPosition, Source{}), - create(0, Source{}), - create(1, Source{}), - create(2, Source{}), - create(42, Source{}), + create(Source{}, ast::Builtin::kPosition), + create(Source{}, 0), + create(Source{}, 1), + create(Source{}, 2), + create(Source{}, 42), }); ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();