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 <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2020-12-14 21:10:07 +00:00 committed by Commit Bot service account
parent 7b2f8d010f
commit 5aad70a069
72 changed files with 554 additions and 554 deletions

View File

@ -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<AccessDecoration>(value_, ctx->Clone(source()));
return ctx->mod->create<AccessDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast

View File

@ -27,9 +27,9 @@ namespace ast {
class AccessDecoration : public Castable<AccessDecoration, TypeDecoration> {
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

View File

@ -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<BindingDecoration>(value_, ctx->Clone(source()));
return ctx->mod->create<BindingDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast

View File

@ -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

View File

@ -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<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
@ -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}

View File

@ -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<BuiltinDecoration>(builtin_, ctx->Clone(source()));
return ctx->mod->create<BuiltinDecoration>(ctx->Clone(source()), builtin_);
}
} // namespace ast

View File

@ -26,9 +26,9 @@ class BuiltinDecoration
: public Castable<BuiltinDecoration, VariableDecoration> {
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

View File

@ -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<BindingDecoration>());
EXPECT_TRUE(d->Is<BuiltinDecoration>());
@ -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}

View File

@ -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<ConstantIdDecoration>(value_, ctx->Clone(source()));
return ctx->mod->create<ConstantIdDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast

View File

@ -26,9 +26,9 @@ class ConstantIdDecoration
: public Castable<ConstantIdDecoration, VariableDecoration> {
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

View File

@ -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<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
@ -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}

View File

@ -43,21 +43,21 @@ namespace {
using DecorationTest = TestHelper;
TEST_F(DecorationTest, AsCorrectType) {
auto* decoration = create<ConstantIdDecoration>(1, Source{});
auto* decoration = create<ConstantIdDecoration>(Source{}, 1);
auto* upcast = static_cast<Decoration*>(decoration);
auto* downcast = As<VariableDecoration>(upcast);
EXPECT_EQ(decoration, downcast);
}
TEST_F(DecorationTest, AsIncorrectType) {
auto* decoration = create<ConstantIdDecoration>(1, Source{});
auto* decoration = create<ConstantIdDecoration>(Source{}, 1);
auto* upcast = static_cast<Decoration*>(decoration);
auto* downcast = As<ArrayDecoration>(upcast);
EXPECT_EQ(nullptr, downcast);
}
TEST_F(DecorationTest, Is) {
Decoration* decoration = create<ConstantIdDecoration>(1, Source{});
Decoration* decoration = create<ConstantIdDecoration>(Source{}, 1);
EXPECT_TRUE(decoration->Is<VariableDecoration>());
EXPECT_FALSE(decoration->Is<ArrayDecoration>());
}

View File

@ -107,25 +107,25 @@ TEST_F(FunctionTest, GetReferenceLocations) {
auto* loc1 = create<Variable>(Source{}, "loc1", StorageClass::kInput, &i32,
false, nullptr,
ast::VariableDecorationList{
create<LocationDecoration>(0, Source{}),
create<LocationDecoration>(Source{}, 0),
});
auto* loc2 = create<Variable>(Source{}, "loc2", StorageClass::kInput, &i32,
false, nullptr,
ast::VariableDecorationList{
create<LocationDecoration>(1, Source{}),
create<LocationDecoration>(Source{}, 1),
});
auto* builtin1 = create<Variable>(
Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr,
ast::VariableDecorationList{
create<BuiltinDecoration>(Builtin::kPosition, Source{}),
create<BuiltinDecoration>(Source{}, Builtin::kPosition),
});
auto* builtin2 = create<Variable>(
Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr,
ast::VariableDecorationList{
create<BuiltinDecoration>(Builtin::kFragDepth, Source{}),
create<BuiltinDecoration>(Source{}, Builtin::kFragDepth),
});
Function f(Source{}, func_sym, "func", VariableList{}, &void_type,
@ -155,25 +155,25 @@ TEST_F(FunctionTest, GetReferenceBuiltins) {
auto* loc1 = create<Variable>(Source{}, "loc1", StorageClass::kInput, &i32,
false, nullptr,
ast::VariableDecorationList{
create<LocationDecoration>(0, Source{}),
create<LocationDecoration>(Source{}, 0),
});
auto* loc2 = create<Variable>(Source{}, "loc2", StorageClass::kInput, &i32,
false, nullptr,
ast::VariableDecorationList{
create<LocationDecoration>(1, Source{}),
create<LocationDecoration>(Source{}, 1),
});
auto* builtin1 = create<Variable>(
Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr,
ast::VariableDecorationList{
create<BuiltinDecoration>(Builtin::kPosition, Source{}),
create<BuiltinDecoration>(Source{}, Builtin::kPosition),
});
auto* builtin2 = create<Variable>(
Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr,
ast::VariableDecorationList{
create<BuiltinDecoration>(Builtin::kFragDepth, Source{}),
create<BuiltinDecoration>(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<WorkgroupDecoration>(2, 4, 6, Source{})});
FunctionDecorationList{create<WorkgroupDecoration>(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<BlockStatement>(Source{}, StatementList{}),
{create<WorkgroupDecoration>(2u, 4u, 6u, Source{})});
{create<WorkgroupDecoration>(Source{}, 2u, 4u, 6u)});
uint32_t x = 0;
uint32_t y = 0;

View File

@ -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<LocationDecoration>(value_, ctx->Clone(source()));
return ctx->mod->create<LocationDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast

View File

@ -27,9 +27,9 @@ class LocationDecoration
: public Castable<LocationDecoration, VariableDecoration> {
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

View File

@ -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<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
@ -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}

View File

@ -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<SetDecoration>(value_, ctx->Clone(source()));
return ctx->mod->create<SetDecoration>(ctx->Clone(source()), value_);
}
} // namespace ast

View File

@ -28,7 +28,7 @@ class SetDecoration : public Castable<SetDecoration, VariableDecoration> {
/// 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

View File

@ -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<BindingDecoration>());
EXPECT_FALSE(d->Is<BuiltinDecoration>());
@ -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}

View File

@ -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<StageDecoration>(stage_, ctx->Clone(source()));
return ctx->mod->create<StageDecoration>(ctx->Clone(source()), stage_);
}
} // namespace ast

View File

@ -27,7 +27,7 @@ class StageDecoration : public Castable<StageDecoration, FunctionDecoration> {
/// 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

View File

@ -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<WorkgroupDecoration>());
EXPECT_TRUE(d->Is<StageDecoration>());
}
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}

View File

@ -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<StrideDecoration>(stride_, ctx->Clone(source()));
return ctx->mod->create<StrideDecoration>(ctx->Clone(source()), stride_);
}
} // namespace ast

View File

@ -28,7 +28,7 @@ class StrideDecoration : public Castable<StrideDecoration, ArrayDecoration> {
/// 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

View File

@ -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<StrideDecoration>());
}
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);

View File

@ -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<StructMemberOffsetDecoration>(offset_,
ctx->Clone(source()));
return ctx->mod->create<StructMemberOffsetDecoration>(ctx->Clone(source()),
offset_);
}
} // namespace ast

View File

@ -27,9 +27,9 @@ class StructMemberOffsetDecoration
: public Castable<StructMemberOffsetDecoration, StructMemberDecoration> {
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

View File

@ -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<StructMemberOffsetDecoration>());
}

View File

@ -30,7 +30,7 @@ using StructMemberTest = TestHelper;
TEST_F(StructMemberTest, Creation) {
type::I32 i32;
StructMemberDecorationList decorations;
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
decorations.emplace_back(create<StructMemberOffsetDecoration>(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<StructMemberOffsetDecoration>(4, Source{}));
decorations.emplace_back(create<StructMemberOffsetDecoration>(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<StructMemberOffsetDecoration>(4, Source{}));
decorations.emplace_back(create<StructMemberOffsetDecoration>(Source{}, 4));
StructMember st{Source{}, "a", &i32, decorations};
std::ostringstream out;

View File

@ -107,7 +107,7 @@ TEST_F(AccessControlTest, MinBufferBindingSizeU32) {
TEST_F(AccessControlTest, MinBufferBindingSizeArray) {
U32 u32;
Array array(&u32, 4,
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(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<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
deco = StructMemberDecorationList();
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(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<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;

View File

@ -175,7 +175,7 @@ TEST_F(AliasTest, MinBufferBindingSizeArray) {
U32 u32;
Array array(&u32, 4,
ArrayDecorationList{
create<StrideDecoration>(4, Source{}),
create<StrideDecoration>(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<StrideDecoration>(4, Source{}),
create<StrideDecoration>(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<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -224,7 +224,7 @@ TEST_F(AliasTest, BaseAlignmentArray) {
U32 u32;
Array array(&u32, 4,
ArrayDecorationList{
create<StrideDecoration>(4, Source{}),
create<StrideDecoration>(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<StrideDecoration>(4, Source{}),
create<StrideDecoration>(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<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;

View File

@ -90,7 +90,7 @@ TEST_F(ArrayTest, TypeName_RuntimeArray) {
TEST_F(ArrayTest, TypeName_WithStride) {
I32 i32;
Array arr{&i32, 3,
ArrayDecorationList{create<StrideDecoration>(16, Source{})}};
ArrayDecorationList{create<StrideDecoration>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
EXPECT_EQ(16u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
}
TEST_F(ArrayTest, MinBufferBindingSizeRuntimeArray) {
U32 u32;
Array arr(&u32, 0,
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
EXPECT_EQ(4u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
}
TEST_F(ArrayTest, BaseAlignmentArray) {
U32 u32;
Array arr(&u32, 4,
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer));
EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer));
}

View File

@ -83,12 +83,12 @@ TEST_F(StructTest, MinBufferBindingSize) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 8));
members.push_back(create<StructMember>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 8));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -167,7 +167,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec2) {
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &vec2, deco));
}
StructDecorationList decos;
@ -186,7 +186,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec3) {
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &vec3, deco));
}
StructDecorationList decos;
@ -206,7 +206,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec4) {
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &vec4, deco));
}
StructDecorationList decos;
@ -225,12 +225,12 @@ TEST_F(StructTest, BaseAlignment) {
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 8));
members.push_back(create<StructMember>(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<StrideDecoration>(4, Source{})});
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 8));
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
}
StructDecorationList decos;
@ -305,7 +305,7 @@ TEST_F(StructTest, BaseAlignmentVec2) {
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &vec2, deco));
}
StructDecorationList decos;
@ -323,7 +323,7 @@ TEST_F(StructTest, BaseAlignmentVec3) {
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &vec3, deco));
}
StructDecorationList decos;
@ -341,7 +341,7 @@ TEST_F(StructTest, BaseAlignmentVec4) {
StructMemberList members;
{
StructMemberDecorationList deco;
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<StructMember>(Source{}, "foo", &vec4, deco));
}
StructDecorationList decos;

View File

@ -140,9 +140,9 @@ TEST_F(VariableTest, WithDecorations) {
auto* var = create<Variable>(
Source{}, "my_var", StorageClass::kFunction, &t, false, nullptr,
VariableDecorationList{
create<LocationDecoration>(1, Source{}),
create<BuiltinDecoration>(Builtin::kPosition, Source{}),
create<ConstantIdDecoration>(1200, Source{}),
create<LocationDecoration>(Source{}, 1),
create<BuiltinDecoration>(Source{}, Builtin::kPosition),
create<ConstantIdDecoration>(Source{}, 1200),
});
EXPECT_TRUE(var->HasLocationDecoration());
@ -155,7 +155,7 @@ TEST_F(VariableTest, ConstantId) {
auto* var = create<Variable>(Source{}, "my_var", StorageClass::kFunction, &t,
false, nullptr,
VariableDecorationList{
create<ConstantIdDecoration>(1200, Source{}),
create<ConstantIdDecoration>(Source{}, 1200),
});
EXPECT_EQ(var->constant_id(), 1200u);
@ -168,8 +168,8 @@ TEST_F(VariableTest, Decorated_to_str) {
create<IdentifierExpression>(
Source{}, mod.RegisterSymbol("expr"), "expr"),
VariableDecorationList{
create<BindingDecoration>(2, Source{}),
create<SetDecoration>(1, Source{}),
create<BindingDecoration>(Source{}, 2),
create<SetDecoration>(Source{}, 1),
});
std::ostringstream out;

View File

@ -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<WorkgroupDecoration>(x_, y_, z_,
ctx->Clone(source()));
return ctx->mod->create<WorkgroupDecoration>(ctx->Clone(source()), x_, y_,
z_);
}
} // namespace ast

View File

@ -29,20 +29,20 @@ class WorkgroupDecoration
: public Castable<WorkgroupDecoration, FunctionDecoration> {
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

View File

@ -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<WorkgroupDecoration>());
EXPECT_FALSE(d->Is<StageDecoration>());
}
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}

View File

@ -231,7 +231,7 @@ class InspectorHelper {
constructor, // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(id, Source{}),
create<ast::ConstantIdDecoration>(Source{}, id),
});
mod()->AddGlobalVariable(var);
}
@ -303,7 +303,7 @@ class InspectorHelper {
ast::StructMemberDecorationList deco;
deco.push_back(
create<ast::StructMemberOffsetDecoration>(offset, Source{}));
create<ast::StructMemberOffsetDecoration>(Source{}, offset));
members.push_back(create<ast::StructMember>(
Source{}, StructMemberName(members.size(), type), type, deco));
@ -394,8 +394,8 @@ class InspectorHelper {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(binding, Source{}),
create<ast::SetDecoration>(set, Source{}),
create<ast::BindingDecoration>(Source{}, binding),
create<ast::SetDecoration>(Source{}, set),
});
mod()->AddGlobalVariable(var);
@ -801,7 +801,7 @@ class InspectorHelper {
array_type_memo_[count] = create<ast::type::Array>(
u32_type(), count,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(4, Source{}),
create<ast::StrideDecoration>(Source{}, 4),
});
}
return array_type_memo_[count];
@ -915,7 +915,7 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) {
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
@ -934,14 +934,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
auto* bar = MakeEmptyBodyFunction(
"bar",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
});
mod()->AddFunction(bar);
@ -966,14 +966,14 @@ TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
auto* foo = MakeCallerBodyFunction(
"foo", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
auto* bar = MakeCallerBodyFunction(
"bar", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod()->AddFunction(bar);
@ -995,7 +995,7 @@ TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) {
auto* foo = MakeCallerBodyFunction(
"foo", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
@ -1014,8 +1014,8 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) {
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::WorkgroupDecoration>(8u, 2u, 1u, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
create<ast::WorkgroupDecoration>(Source{}, 8u, 2u, 1u),
});
mod()->AddFunction(foo);
@ -1037,7 +1037,7 @@ TEST_F(InspectorGetEntryPointTest, NoInOutVariables) {
auto* foo = MakeCallerBodyFunction(
"foo", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
@ -1081,7 +1081,7 @@ TEST_F(InspectorGetEntryPointTest, FunctionInOutVariables) {
auto* foo = MakeCallerBodyFunction(
"foo", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
@ -1159,7 +1159,7 @@ TEST_F(InspectorGetEntryPointTest, FunctionMultipleInOutVariables) {
auto* foo = MakeCallerBodyFunction(
"foo", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
auto* bar = MakeInOutVariableBodyFunction(
"bar", {{"in2_var", "out_var"}},
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
auto* bar = MakeCallerBodyFunction(
"bar", "func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
});
mod()->AddFunction(bar);
@ -1291,7 +1291,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_OneEntryPoint) {
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
@ -1310,7 +1310,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest,
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(foo);
@ -1319,7 +1319,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest,
auto* bar = MakeEmptyBodyFunction(
"bar",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(
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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);
@ -2051,7 +2051,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) {
auto* func = MakeEmptyBodyFunction(
"ep_func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);
@ -2163,7 +2163,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) {
auto* func = MakeEmptyBodyFunction(
"ep_func",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);
@ -2252,7 +2252,7 @@ TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) {
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);
@ -2479,7 +2479,7 @@ TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) {
auto* foo = MakeEmptyBodyFunction(
"foo",
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);

View File

@ -906,7 +906,7 @@ bool FunctionEmitter::ParseFunctionDeclaration(FunctionDeclaration* decl) {
}
ast::FunctionDecorationList decos;
if (ep_info_ != nullptr) {
decos.emplace_back(create<ast::StageDecoration>(ep_info_->stage, Source{}));
decos.emplace_back(create<ast::StageDecoration>(Source{}, ep_info_->stage));
}
decl->name = name;

View File

@ -447,7 +447,7 @@ ast::StructMemberDecoration* ParserImpl::ConvertMemberDecoration(
<< ShowType(struct_type_id);
return nullptr;
}
return create<ast::StructMemberOffsetDecoration>(decoration[1], Source{});
return create<ast::StructMemberOffsetDecoration>(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<ast::StrideDecoration>(stride, Source{}));
decorations->push_back(create<ast::StrideDecoration>(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<ast::ConstantIdDecoration>(deco[1], Source{});
auto* cid = create<ast::ConstantIdDecoration>(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::BuiltinDecoration>(ast::Builtin::kPosition, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
});
ast_module_.AddGlobalVariable(var);
@ -1255,7 +1255,7 @@ ast::Variable* ParserImpl::MakeVariable(
return nullptr;
}
decorations.emplace_back(
create<ast::BuiltinDecoration>(ast_builtin, Source{}));
create<ast::BuiltinDecoration>(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<ast::LocationDecoration>(deco[1], Source{}));
create<ast::LocationDecoration>(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<ast::SetDecoration>(deco[1], Source{}));
decorations.emplace_back(create<ast::SetDecoration>(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<ast::BindingDecoration>(deco[1], Source{}));
create<ast::BindingDecoration>(Source{}, deco[1]));
}
}

View File

@ -2865,7 +2865,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (val.errored)
return Failure::kErrored;
return create<ast::AccessDecoration>(val.value, val.source);
return create<ast::AccessDecoration>(val.source, val.value);
});
}
@ -2876,7 +2876,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (val.errored)
return Failure::kErrored;
return create<ast::LocationDecoration>(val.value, val.source);
return create<ast::LocationDecoration>(val.source, val.value);
});
}
@ -2887,7 +2887,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (val.errored)
return Failure::kErrored;
return create<ast::BindingDecoration>(val.value, val.source);
return create<ast::BindingDecoration>(val.source, val.value);
});
}
@ -2898,7 +2898,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (val.errored)
return Failure::kErrored;
return create<ast::SetDecoration>(val.value, val.source);
return create<ast::SetDecoration>(val.source, val.value);
});
}
@ -2908,7 +2908,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (builtin.errored)
return Failure::kErrored;
return create<ast::BuiltinDecoration>(builtin.value, builtin.source);
return create<ast::BuiltinDecoration>(builtin.source, builtin.value);
});
}
@ -2937,7 +2937,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
}
}
return create<ast::WorkgroupDecoration>(x, y, z, t.source());
return create<ast::WorkgroupDecoration>(t.source(), x, y, z);
});
}
@ -2947,7 +2947,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (stage.errored)
return Failure::kErrored;
return create<ast::StageDecoration>(stage.value, stage.source);
return create<ast::StageDecoration>(stage.source, stage.value);
});
}
@ -2962,7 +2962,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (val.errored)
return Failure::kErrored;
return create<ast::StrideDecoration>(val.value, t.source());
return create<ast::StrideDecoration>(t.source(), val.value);
});
}
@ -2973,7 +2973,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
if (val.errored)
return Failure::kErrored;
return create<ast::StructMemberOffsetDecoration>(val.value, t.source());
return create<ast::StructMemberOffsetDecoration>(t.source(), val.value);
});
}

View File

@ -66,7 +66,7 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
ast::VariableDecorationList{
// decorations
mod->create<ast::BuiltinDecoration>(
ast::Builtin::kPointSize, Source{}),
Source{}, ast::Builtin::kPointSize),
});
mod->AddGlobalVariable(pointsize_var);

View File

@ -71,8 +71,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageBasic) {
auto* entry = create<ast::Function>(
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_, block,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kVertex),
});
mod->AddFunction(entry);
@ -141,8 +141,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageEmpty) {
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex,
Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment,
Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod->AddFunction(compute_entry);
}

View File

@ -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<ast::StructMemberOffsetDecoration>(offset, Source{}));
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
members.push_back(mod->create<ast::StructMember>(
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<ast::StructMemberOffsetDecoration>(offset, Source{}));
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
members.push_back(mod->create<ast::StructMember>(
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<ast::BindingDecoration>(binding_, Source{}),
mod->create<ast::SetDecoration>(set_, Source{}),
mod->create<ast::BindingDecoration>(Source{}, binding_),
mod->create<ast::SetDecoration>(Source{}, set_),
}); // decorations
mod->AddGlobalVariable(idx_var);

View File

@ -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<ast::BuiltinDecoration>(builtin, Source{})}));
{create<ast::BuiltinDecoration>(Source{}, builtin)}));
}
ast::Function* AddFunction(const std::string& name,

View File

@ -173,7 +173,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() {
ast::VariableDecorationList{
// decorations
out->create<ast::BuiltinDecoration>(
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::BuiltinDecoration>(
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<ast::type::Array>(
GetU32Type(), 0,
ast::ArrayDecorationList{
out->create<ast::StrideDecoration>(4u, Source{}),
out->create<ast::StrideDecoration>(Source{}, 4u),
});
// Creating the struct type
ast::StructMemberList members;
ast::StructMemberDecorationList member_dec;
member_dec.push_back(
out->create<ast::StructMemberOffsetDecoration>(0u, Source{}));
out->create<ast::StructMemberOffsetDecoration>(Source{}, 0u));
members.push_back(out->create<ast::StructMember>(
Source{}, kStructBufferName, internal_array_type, std::move(member_dec)));
@ -288,8 +288,8 @@ void VertexPulling::State::AddVertexStorageBuffers() {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
out->create<ast::BindingDecoration>(i, Source{}),
out->create<ast::SetDecoration>(cfg.pulling_set, Source{}),
out->create<ast::BindingDecoration>(Source{}, i),
out->create<ast::SetDecoration>(Source{}, cfg.pulling_set),
});
out->AddGlobalVariable(var);
}

View File

@ -51,7 +51,7 @@ class VertexPullingHelper {
mod_->create<ast::type::Void>(),
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{create<ast::StageDecoration>(
ast::PipelineStage::kVertex, Source{})});
Source{}, ast::PipelineStage::kVertex)});
mod()->AddFunction(func);
}
@ -79,7 +79,7 @@ class VertexPullingHelper {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(location, Source{}),
create<ast::LocationDecoration>(Source{}, location),
});
mod_->AddGlobalVariable(var);
@ -139,7 +139,7 @@ TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
mod()->create<ast::type::Void>(),
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod()->AddFunction(func);
@ -437,7 +437,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kVertexIdx, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kVertexIdx),
}));
mod()->AddGlobalVariable(create<ast::Variable>(
@ -449,7 +449,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kInstanceIdx, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kInstanceIdx),
}));
InitTransform(

View File

@ -5338,7 +5338,7 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) {
auto* ep_1 = create<ast::Function>(
Source{}, mod->RegisterSymbol("ep_1"), "ep_1", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
body = create<ast::BlockStatement>(
@ -5356,7 +5356,7 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) {
auto* ep_2 = create<ast::Function>(
Source{}, mod->RegisterSymbol("ep_2"), "ep_2", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod->AddFunction(func_b);

View File

@ -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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);
@ -79,7 +79,7 @@ TEST_F(ValidateFunctionTest,
params, &void_type,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);
@ -149,7 +149,7 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_Pass) {
auto* func = create<ast::Function>(
Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);

View File

@ -398,7 +398,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) {
Source{}, mod()->RegisterSymbol("my_func"), "my_func", params, &void_type,
body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func0);

View File

@ -211,7 +211,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayInFunction_Fail) {
auto* func = create<ast::Function>(
Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod()->AddFunction(func);

View File

@ -58,7 +58,7 @@ TEST_F(HlslGeneratorImplTest_Alias, EmitAlias_Struct) {
create<ast::StructMember>(
Source{}, "b", &i32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
},
ast::StructDecorationList{});

View File

@ -60,7 +60,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -100,7 +100,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod.AddFunction(func);
@ -139,7 +139,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -151,7 +151,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -180,7 +180,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod.AddFunction(func);
@ -219,7 +219,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -231,7 +231,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -260,7 +260,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
});
mod.AddFunction(func);
@ -299,7 +299,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -311,7 +311,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -339,7 +339,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -375,7 +375,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -387,7 +387,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -415,7 +415,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
});
mod.AddFunction(func);
@ -446,7 +446,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -458,7 +458,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -486,7 +486,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
});
mod.AddFunction(func);
@ -524,7 +524,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
});
auto* depth_var = create<ast::Variable>(
@ -536,7 +536,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
});
td.RegisterVariableForTesting(coord_var);
@ -562,7 +562,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);

View File

@ -153,7 +153,7 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -165,7 +165,7 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -228,7 +228,7 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
});
auto* depth_var = create<ast::Variable>(
@ -240,7 +240,7 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -307,8 +307,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -381,8 +381,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -469,8 +469,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -547,8 +547,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -625,8 +625,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -685,7 +685,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -697,7 +697,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
auto* val_var =
@ -709,7 +709,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
td.RegisterVariableForTesting(foo_var);
@ -776,7 +776,7 @@ TEST_F(
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -822,7 +822,7 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
});
td.RegisterVariableForTesting(depth_var);
@ -873,7 +873,7 @@ TEST_F(HlslGeneratorImplTest_Function,
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -913,7 +913,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
});
auto* depth_var = create<ast::Variable>(
@ -925,7 +925,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
});
td.RegisterVariableForTesting(coord_var);
@ -988,7 +988,7 @@ TEST_F(
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -1032,8 +1032,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -1133,8 +1133,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -1232,7 +1232,7 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(bar_var);
@ -1268,7 +1268,7 @@ TEST_F(HlslGeneratorImplTest_Function,
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -1300,7 +1300,7 @@ TEST_F(HlslGeneratorImplTest_Function,
ast::VariableList{}, &void_type,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -1325,7 +1325,7 @@ TEST_F(HlslGeneratorImplTest_Function,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
});
mod.AddFunction(func);
@ -1353,8 +1353,8 @@ TEST_F(HlslGeneratorImplTest_Function,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
create<ast::WorkgroupDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
@ -1447,8 +1447,8 @@ TEST_F(HlslGeneratorImplTest_Function,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(0, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(Source{}, 0),
});
mod.AddConstructedType(&s);
@ -1480,8 +1480,8 @@ TEST_F(HlslGeneratorImplTest_Function,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod.AddFunction(func);
@ -1512,8 +1512,8 @@ TEST_F(HlslGeneratorImplTest_Function,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod.AddFunction(func);

View File

@ -50,7 +50,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) {
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -213,11 +213,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "z", &i32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "a", &mat,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
},
ast::StructDecorationList{});
@ -288,11 +288,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
auto* str =
@ -471,7 +471,7 @@ TEST_F(
ast::StructMemberList members;
ast::StructMemberDecorationList deco;
deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
members.push_back(create<ast::StructMember>(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<ast::StrideDecoration>(4, Source{}),
create<ast::StrideDecoration>(Source{}, 4),
});
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(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<ast::StrideDecoration>(4, Source{}),
create<ast::StrideDecoration>(Source{}, 4),
});
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StrideDecoration>(4, Source{}),
create<ast::StrideDecoration>(Source{}, 4),
});
ast::StructMemberList members;
ast::StructMemberDecorationList a_deco;
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &ivec3, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &ivec3, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec3, b_deco));
auto* str =
@ -1026,11 +1026,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
},
ast::StructDecorationList{});
@ -1038,7 +1038,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::type::Array ary(&data, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(32, Source{}),
create<ast::StrideDecoration>(Source{}, 32),
});
auto* pre_str = create<ast::Struct>(
@ -1047,7 +1047,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
},
ast::StructDecorationList{});
@ -1117,11 +1117,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
},
ast::StructDecorationList{});
@ -1129,14 +1129,14 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::type::Array ary(
&data, 4,
ast::ArrayDecorationList{create<ast::StrideDecoration>(32, Source{})});
ast::ArrayDecorationList{create<ast::StrideDecoration>(Source{}, 32)});
auto* pre_str = create<ast::Struct>(
Source{},
ast::StructMemberList{create<ast::StructMember>(
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
ast::StructDecorationList{});
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
@ -1207,11 +1207,11 @@ TEST_F(
create<ast::StructMember>(
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
},
ast::StructDecorationList{});
@ -1219,7 +1219,7 @@ TEST_F(
ast::type::Array ary(&data, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(32, Source{}),
create<ast::StrideDecoration>(Source{}, 32),
});
auto* pre_str = create<ast::Struct>(
@ -1227,7 +1227,7 @@ TEST_F(
ast::StructMemberList{create<ast::StructMember>(
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
ast::StructDecorationList{});
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
@ -1297,11 +1297,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
},
ast::StructDecorationList{});
@ -1309,7 +1309,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::type::Array ary(&data, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(32, Source{}),
create<ast::StrideDecoration>(Source{}, 32),
});
auto* pre_str = create<ast::Struct>(
@ -1317,7 +1317,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList{create<ast::StructMember>(
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
ast::StructDecorationList{});
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
@ -1387,11 +1387,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
},
ast::StructDecorationList{});
@ -1399,7 +1399,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::type::Array ary(&data, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(32, Source{}),
create<ast::StrideDecoration>(Source{}, 32),
});
auto* pre_str = create<ast::Struct>(
@ -1407,7 +1407,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList{create<ast::StructMember>(
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
ast::StructDecorationList{});
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
@ -1487,11 +1487,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
create<ast::StructMember>(
Source{}, "a", &ivec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
create<ast::StructMember>(
Source{}, "b", &fvec3,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
},
ast::StructDecorationList{});
@ -1499,7 +1499,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::type::Array ary(&data, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(32, Source{}),
create<ast::StrideDecoration>(Source{}, 32),
});
auto* pre_str = create<ast::Struct>(
@ -1507,7 +1507,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
ast::StructMemberList{create<ast::StructMember>(
Source{}, "c", &ary,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
ast::StructDecorationList{});
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);

View File

@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) {
create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(23, Source{}),
create<ast::ConstantIdDecoration>(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<ast::ConstantIdDecoration>(23, Source{}),
create<ast::ConstantIdDecoration>(Source{}, 23),
});
ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error();

View File

@ -178,7 +178,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 128));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
ast::StructDecorationList decos;

View File

@ -58,7 +58,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_Struct) {
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
auto* str =

View File

@ -59,7 +59,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -71,7 +71,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -99,7 +99,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -148,7 +148,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -176,7 +176,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -225,7 +225,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -253,7 +253,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -302,7 +302,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -330,7 +330,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -376,7 +376,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -404,7 +404,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -445,7 +445,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(foo_var);
@ -473,7 +473,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
});
auto* depth_var = create<ast::Variable>(
@ -520,7 +520,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
});
td.RegisterVariableForTesting(coord_var);
@ -547,7 +547,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) {
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);

View File

@ -164,7 +164,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -176,7 +176,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(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::StageDecoration>(
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::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
});
auto* depth_var = create<ast::Variable>(
@ -253,7 +253,7 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -400,8 +400,8 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -486,8 +486,8 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -557,7 +557,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
auto* bar_var =
@ -569,7 +569,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
auto* val_var =
@ -581,7 +581,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(0, Source{}),
create<ast::LocationDecoration>(Source{}, 0),
});
td.RegisterVariableForTesting(foo_var);
@ -648,7 +648,7 @@ TEST_F(
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -697,7 +697,7 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
});
td.RegisterVariableForTesting(depth_var);
@ -749,7 +749,7 @@ TEST_F(MslGeneratorImplTest,
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -792,7 +792,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
});
auto* depth_var = create<ast::Variable>(
@ -804,7 +804,7 @@ TEST_F(
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
});
td.RegisterVariableForTesting(coord_var);
@ -867,7 +867,7 @@ TEST_F(
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func_1);
@ -909,8 +909,8 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -1024,8 +1024,8 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -1144,8 +1144,8 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
mod.AddFunction(func);
@ -1247,7 +1247,7 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(1, Source{}),
create<ast::LocationDecoration>(Source{}, 1),
});
td.RegisterVariableForTesting(bar_var);
@ -1283,7 +1283,7 @@ TEST_F(MslGeneratorImplTest,
auto* func_1 = create<ast::Function>(
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
@ -1412,8 +1412,8 @@ TEST_F(MslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(0, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(Source{}, 0),
});
mod.AddConstructedType(&s);
@ -1445,8 +1445,8 @@ TEST_F(MslGeneratorImplTest,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod.AddFunction(func);
@ -1476,8 +1476,8 @@ TEST_F(MslGeneratorImplTest,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod.AddFunction(func);

View File

@ -74,7 +74,7 @@ TEST_F(MslGeneratorImplTest, Emit_SpecConstant) {
create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(23, Source{}),
create<ast::ConstantIdDecoration>(Source{}, 23),
});
ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error();

View File

@ -54,7 +54,7 @@ TEST_F(MslGeneratorImplTest, Generate) {
Source{}, mod.RegisterSymbol("my_func"), "my_func", ast::VariableList{},
&void_type, create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(128, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 128));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(32, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 32));
members.push_back(create<ast::StructMember>(Source{}, "e", &inner_s, decos));
decos.push_back(create<ast::StructMemberOffsetDecoration>(64, Source{}));
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 64));
members.push_back(create<ast::StructMember>(Source{}, "f", &f32, decos));
auto* outer_str =

View File

@ -179,7 +179,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) {
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =
@ -226,15 +226,15 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_InjectPadding) {
create<ast::StructMember>(
Source{}, "a", &i32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
create<ast::StructMember>(
Source{}, "b", &f32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(32, Source{})}),
create<ast::StructMemberOffsetDecoration>(Source{}, 32)}),
create<ast::StructMember>(
Source{}, "c", &f32,
ast::StructMemberDecorationList{
create<ast::StructMemberOffsetDecoration>(128, Source{})}),
create<ast::StructMemberOffsetDecoration>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
ast::StructDecorationList decos;

View File

@ -107,7 +107,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) {
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
auto* str =

View File

@ -45,7 +45,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage) {
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(params.stage, Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
create<ast::WorkgroupDecoration>(Source{}, 2u, 4u, 6u),
create<ast::StageDecoration>(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<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
ast::Function func2(
Source{}, mod->RegisterSymbol("main2"), "main2", {}, &void_type,
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
});
ASSERT_TRUE(b.GenerateFunction(&func1)) << b.error();

View File

@ -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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(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<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(0, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(Source{}, 0),
});
mod->AddConstructedType(&s);
@ -328,8 +328,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
auto* func = create<ast::Function>(
Source{}, mod->RegisterSymbol("a"), "a", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod->AddFunction(func);
@ -360,8 +360,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
auto* func = create<ast::Function>(
Source{}, mod->RegisterSymbol("b"), "b", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod->AddFunction(func);

View File

@ -251,7 +251,7 @@ TEST_F(BuilderTest, GlobalVar_WithLocation) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::LocationDecoration>(5, Source{}),
create<ast::LocationDecoration>(Source{}, 5),
});
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
@ -277,8 +277,8 @@ TEST_F(BuilderTest, GlobalVar_WithBindingAndSet) {
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(2, Source{}),
create<ast::SetDecoration>(3, Source{}),
create<ast::BindingDecoration>(Source{}, 2),
create<ast::SetDecoration>(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::BuiltinDecoration>(ast::Builtin::kPosition, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
});
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
@ -334,7 +334,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Bool) {
create<ast::BoolLiteral>(Source{}, &bool_type, true)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(1200, Source{}),
create<ast::ConstantIdDecoration>(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<ast::ConstantIdDecoration>(1200, Source{}),
create<ast::ConstantIdDecoration>(Source{}, 1200),
});
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
@ -390,7 +390,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar) {
create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
ast::VariableDecorationList{
// decorations
create<ast::ConstantIdDecoration>(0, Source{}),
create<ast::ConstantIdDecoration>(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<ast::ConstantIdDecoration>(0, Source{}),
create<ast::ConstantIdDecoration>(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<ast::ConstantIdDecoration>(0, Source{}),
create<ast::ConstantIdDecoration>(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<ast::ConstantIdDecoration>(0, Source{}),
create<ast::ConstantIdDecoration>(Source{}, 0),
});
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();

View File

@ -125,7 +125,7 @@ TEST_F(BuilderTest_Type, GenerateArray_WithStride) {
ast::type::Array ary(&i32, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(16u, Source{}),
create<ast::StrideDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
ast::StructMemberDecorationList b_decos;
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(8, Source{}));
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 8));
ast::StructMemberList members;
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
ast::StructMemberDecorationList b_decos;
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
ast::StructMemberDecorationList c_decos;
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(48, Source{}));
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
ast::StructMemberDecorationList b_decos;
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(16, Source{}));
b_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 16));
ast::StructMemberDecorationList c_decos;
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(48, Source{}));
c_decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 48));
ast::StructMemberList members;
members.push_back(

View File

@ -48,7 +48,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) {
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
ast::StructMemberDecorationList b_deco;
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
auto* str =

View File

@ -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<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
create<ast::WorkgroupDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::StageDecoration>(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::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
create<ast::WorkgroupDecoration>(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<ast::StructMemberOffsetDecoration>(0, Source{}));
a_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
ast::StructDecorationList s_decos;
@ -217,8 +217,8 @@ TEST_F(WgslGeneratorImplTest,
nullptr, // constructor
ast::VariableDecorationList{
// decorations
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(0, Source{}),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(Source{}, 0),
});
mod.AddConstructedType(&s);
@ -250,8 +250,8 @@ TEST_F(WgslGeneratorImplTest,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod.AddFunction(func);
@ -281,8 +281,8 @@ TEST_F(WgslGeneratorImplTest,
auto* func = create<ast::Function>(
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
Source{}),
create<ast::StageDecoration>(Source{},
ast::PipelineStage::kCompute),
});
mod.AddFunction(func);

View File

@ -107,7 +107,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) {
ast::type::Bool b;
ast::type::Array a(&b, 4,
ast::ArrayDecorationList{
create<ast::StrideDecoration>(16u, Source{}),
create<ast::StrideDecoration>(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<ast::StrideDecoration>(16u, Source{}),
create<ast::StrideDecoration>(32u, Source{}),
create<ast::StrideDecoration>(Source{}, 16u),
create<ast::StrideDecoration>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(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<ast::StructMemberOffsetDecoration>(4, Source{}));
b_deco.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
ast::StructDecorationList decos;

View File

@ -58,7 +58,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) {
ast::Variable v(Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr,
ast::VariableDecorationList{
create<ast::LocationDecoration>(2, Source{}),
create<ast::LocationDecoration>(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::BuiltinDecoration>(ast::Builtin::kPosition, Source{}),
create<ast::BindingDecoration>(0, Source{}),
create<ast::SetDecoration>(1, Source{}),
create<ast::LocationDecoration>(2, Source{}),
create<ast::ConstantIdDecoration>(42, Source{}),
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
create<ast::BindingDecoration>(Source{}, 0),
create<ast::SetDecoration>(Source{}, 1),
create<ast::LocationDecoration>(Source{}, 2),
create<ast::ConstantIdDecoration>(Source{}, 42),
});
ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();