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:
parent
7b2f8d010f
commit
5aad70a069
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::AccessDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
AccessDecoration::AccessDecoration(AccessControl val, const Source& source)
|
AccessDecoration::AccessDecoration(const Source& source, AccessControl val)
|
||||||
: Base(source), value_(val) {}
|
: Base(source), value_(val) {}
|
||||||
|
|
||||||
AccessDecoration::~AccessDecoration() = default;
|
AccessDecoration::~AccessDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void AccessDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessDecoration* AccessDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -27,9 +27,9 @@ namespace ast {
|
||||||
class AccessDecoration : public Castable<AccessDecoration, TypeDecoration> {
|
class AccessDecoration : public Castable<AccessDecoration, TypeDecoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param value the access value
|
|
||||||
/// @param source the source of this decoration
|
/// @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;
|
~AccessDecoration() override;
|
||||||
|
|
||||||
/// @returns the access control value
|
/// @returns the access control value
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::BindingDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BindingDecoration::BindingDecoration(uint32_t val, const Source& source)
|
BindingDecoration::BindingDecoration(const Source& source, uint32_t val)
|
||||||
: Base(source), value_(val) {}
|
: Base(source), value_(val) {}
|
||||||
|
|
||||||
BindingDecoration::~BindingDecoration() = default;
|
BindingDecoration::~BindingDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void BindingDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
BindingDecoration* BindingDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -29,7 +29,7 @@ class BindingDecoration
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param value the binding value
|
/// @param value the binding value
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
BindingDecoration(uint32_t value, const Source& source);
|
BindingDecoration(const Source& source, uint32_t value);
|
||||||
~BindingDecoration() override;
|
~BindingDecoration() override;
|
||||||
|
|
||||||
/// @returns the binding value
|
/// @returns the binding value
|
||||||
|
|
|
@ -24,12 +24,12 @@ namespace {
|
||||||
using BindingDecorationTest = TestHelper;
|
using BindingDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(BindingDecorationTest, Creation) {
|
TEST_F(BindingDecorationTest, Creation) {
|
||||||
BindingDecoration d{2, Source{}};
|
BindingDecoration d{Source{}, 2};
|
||||||
EXPECT_EQ(2u, d.value());
|
EXPECT_EQ(2u, d.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BindingDecorationTest, Is) {
|
TEST_F(BindingDecorationTest, Is) {
|
||||||
BindingDecoration bd{2, Source{}};
|
BindingDecoration bd{Source{}, 2};
|
||||||
Decoration* d = &bd;
|
Decoration* d = &bd;
|
||||||
EXPECT_TRUE(d->Is<BindingDecoration>());
|
EXPECT_TRUE(d->Is<BindingDecoration>());
|
||||||
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
||||||
|
@ -39,7 +39,7 @@ TEST_F(BindingDecorationTest, Is) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BindingDecorationTest, ToStr) {
|
TEST_F(BindingDecorationTest, ToStr) {
|
||||||
BindingDecoration d{2, Source{}};
|
BindingDecoration d{Source{}, 2};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(BindingDecoration{2}
|
EXPECT_EQ(out.str(), R"(BindingDecoration{2}
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::BuiltinDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
BuiltinDecoration::BuiltinDecoration(Builtin builtin, const Source& source)
|
BuiltinDecoration::BuiltinDecoration(const Source& source, Builtin builtin)
|
||||||
: Base(source), builtin_(builtin) {}
|
: Base(source), builtin_(builtin) {}
|
||||||
|
|
||||||
BuiltinDecoration::~BuiltinDecoration() = default;
|
BuiltinDecoration::~BuiltinDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void BuiltinDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
BuiltinDecoration* BuiltinDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -26,9 +26,9 @@ class BuiltinDecoration
|
||||||
: public Castable<BuiltinDecoration, VariableDecoration> {
|
: public Castable<BuiltinDecoration, VariableDecoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param builtin the builtin value
|
|
||||||
/// @param source the source of this decoration
|
/// @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;
|
~BuiltinDecoration() override;
|
||||||
|
|
||||||
/// @returns the builtin value
|
/// @returns the builtin value
|
||||||
|
|
|
@ -24,12 +24,12 @@ namespace {
|
||||||
using BuiltinDecorationTest = TestHelper;
|
using BuiltinDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(BuiltinDecorationTest, Creation) {
|
TEST_F(BuiltinDecorationTest, Creation) {
|
||||||
BuiltinDecoration d{Builtin::kFragDepth, Source{}};
|
BuiltinDecoration d{Source{}, Builtin::kFragDepth};
|
||||||
EXPECT_EQ(Builtin::kFragDepth, d.value());
|
EXPECT_EQ(Builtin::kFragDepth, d.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BuiltinDecorationTest, Is) {
|
TEST_F(BuiltinDecorationTest, Is) {
|
||||||
BuiltinDecoration bd{Builtin::kFragDepth, Source{}};
|
BuiltinDecoration bd{Source{}, Builtin::kFragDepth};
|
||||||
Decoration* d = &bd;
|
Decoration* d = &bd;
|
||||||
EXPECT_FALSE(d->Is<BindingDecoration>());
|
EXPECT_FALSE(d->Is<BindingDecoration>());
|
||||||
EXPECT_TRUE(d->Is<BuiltinDecoration>());
|
EXPECT_TRUE(d->Is<BuiltinDecoration>());
|
||||||
|
@ -39,7 +39,7 @@ TEST_F(BuiltinDecorationTest, Is) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(BuiltinDecorationTest, ToStr) {
|
TEST_F(BuiltinDecorationTest, ToStr) {
|
||||||
BuiltinDecoration d{Builtin::kFragDepth, Source{}};
|
BuiltinDecoration d{Source{}, Builtin::kFragDepth};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(BuiltinDecoration{frag_depth}
|
EXPECT_EQ(out.str(), R"(BuiltinDecoration{frag_depth}
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::ConstantIdDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
ConstantIdDecoration::ConstantIdDecoration(uint32_t val, const Source& source)
|
ConstantIdDecoration::ConstantIdDecoration(const Source& source, uint32_t val)
|
||||||
: Base(source), value_(val) {}
|
: Base(source), value_(val) {}
|
||||||
|
|
||||||
ConstantIdDecoration::~ConstantIdDecoration() = default;
|
ConstantIdDecoration::~ConstantIdDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void ConstantIdDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantIdDecoration* ConstantIdDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -26,9 +26,9 @@ class ConstantIdDecoration
|
||||||
: public Castable<ConstantIdDecoration, VariableDecoration> {
|
: public Castable<ConstantIdDecoration, VariableDecoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param val the constant_id value
|
|
||||||
/// @param source the source of this decoration
|
/// @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;
|
~ConstantIdDecoration() override;
|
||||||
|
|
||||||
/// @returns the constant id value
|
/// @returns the constant id value
|
||||||
|
|
|
@ -23,12 +23,12 @@ namespace {
|
||||||
using ConstantIdDecorationTest = TestHelper;
|
using ConstantIdDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(ConstantIdDecorationTest, Creation) {
|
TEST_F(ConstantIdDecorationTest, Creation) {
|
||||||
ConstantIdDecoration d{12, Source{}};
|
ConstantIdDecoration d{Source{}, 12};
|
||||||
EXPECT_EQ(12u, d.value());
|
EXPECT_EQ(12u, d.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ConstantIdDecorationTest, Is) {
|
TEST_F(ConstantIdDecorationTest, Is) {
|
||||||
ConstantIdDecoration cd{27, Source{}};
|
ConstantIdDecoration cd{Source{}, 27};
|
||||||
Decoration* d = &cd;
|
Decoration* d = &cd;
|
||||||
EXPECT_FALSE(d->Is<BindingDecoration>());
|
EXPECT_FALSE(d->Is<BindingDecoration>());
|
||||||
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
||||||
|
@ -38,7 +38,7 @@ TEST_F(ConstantIdDecorationTest, Is) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ConstantIdDecorationTest, ToStr) {
|
TEST_F(ConstantIdDecorationTest, ToStr) {
|
||||||
ConstantIdDecoration d{1200, Source{}};
|
ConstantIdDecoration d{Source{}, 1200};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(ConstantIdDecoration{1200}
|
EXPECT_EQ(out.str(), R"(ConstantIdDecoration{1200}
|
||||||
|
|
|
@ -43,21 +43,21 @@ namespace {
|
||||||
using DecorationTest = TestHelper;
|
using DecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(DecorationTest, AsCorrectType) {
|
TEST_F(DecorationTest, AsCorrectType) {
|
||||||
auto* decoration = create<ConstantIdDecoration>(1, Source{});
|
auto* decoration = create<ConstantIdDecoration>(Source{}, 1);
|
||||||
auto* upcast = static_cast<Decoration*>(decoration);
|
auto* upcast = static_cast<Decoration*>(decoration);
|
||||||
auto* downcast = As<VariableDecoration>(upcast);
|
auto* downcast = As<VariableDecoration>(upcast);
|
||||||
EXPECT_EQ(decoration, downcast);
|
EXPECT_EQ(decoration, downcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DecorationTest, AsIncorrectType) {
|
TEST_F(DecorationTest, AsIncorrectType) {
|
||||||
auto* decoration = create<ConstantIdDecoration>(1, Source{});
|
auto* decoration = create<ConstantIdDecoration>(Source{}, 1);
|
||||||
auto* upcast = static_cast<Decoration*>(decoration);
|
auto* upcast = static_cast<Decoration*>(decoration);
|
||||||
auto* downcast = As<ArrayDecoration>(upcast);
|
auto* downcast = As<ArrayDecoration>(upcast);
|
||||||
EXPECT_EQ(nullptr, downcast);
|
EXPECT_EQ(nullptr, downcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DecorationTest, Is) {
|
TEST_F(DecorationTest, Is) {
|
||||||
Decoration* decoration = create<ConstantIdDecoration>(1, Source{});
|
Decoration* decoration = create<ConstantIdDecoration>(Source{}, 1);
|
||||||
EXPECT_TRUE(decoration->Is<VariableDecoration>());
|
EXPECT_TRUE(decoration->Is<VariableDecoration>());
|
||||||
EXPECT_FALSE(decoration->Is<ArrayDecoration>());
|
EXPECT_FALSE(decoration->Is<ArrayDecoration>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,25 +107,25 @@ TEST_F(FunctionTest, GetReferenceLocations) {
|
||||||
auto* loc1 = create<Variable>(Source{}, "loc1", StorageClass::kInput, &i32,
|
auto* loc1 = create<Variable>(Source{}, "loc1", StorageClass::kInput, &i32,
|
||||||
false, nullptr,
|
false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<LocationDecoration>(0, Source{}),
|
create<LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* loc2 = create<Variable>(Source{}, "loc2", StorageClass::kInput, &i32,
|
auto* loc2 = create<Variable>(Source{}, "loc2", StorageClass::kInput, &i32,
|
||||||
false, nullptr,
|
false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<LocationDecoration>(1, Source{}),
|
create<LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* builtin1 = create<Variable>(
|
auto* builtin1 = create<Variable>(
|
||||||
Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr,
|
Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<BuiltinDecoration>(Builtin::kPosition, Source{}),
|
create<BuiltinDecoration>(Source{}, Builtin::kPosition),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* builtin2 = create<Variable>(
|
auto* builtin2 = create<Variable>(
|
||||||
Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr,
|
Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<BuiltinDecoration>(Builtin::kFragDepth, Source{}),
|
create<BuiltinDecoration>(Source{}, Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
Function f(Source{}, func_sym, "func", VariableList{}, &void_type,
|
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,
|
auto* loc1 = create<Variable>(Source{}, "loc1", StorageClass::kInput, &i32,
|
||||||
false, nullptr,
|
false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<LocationDecoration>(0, Source{}),
|
create<LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* loc2 = create<Variable>(Source{}, "loc2", StorageClass::kInput, &i32,
|
auto* loc2 = create<Variable>(Source{}, "loc2", StorageClass::kInput, &i32,
|
||||||
false, nullptr,
|
false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<LocationDecoration>(1, Source{}),
|
create<LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* builtin1 = create<Variable>(
|
auto* builtin1 = create<Variable>(
|
||||||
Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr,
|
Source{}, "builtin1", StorageClass::kInput, &i32, false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<BuiltinDecoration>(Builtin::kPosition, Source{}),
|
create<BuiltinDecoration>(Source{}, Builtin::kPosition),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* builtin2 = create<Variable>(
|
auto* builtin2 = create<Variable>(
|
||||||
Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr,
|
Source{}, "builtin2", StorageClass::kInput, &i32, false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<BuiltinDecoration>(Builtin::kFragDepth, Source{}),
|
create<BuiltinDecoration>(Source{}, Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
Function f(Source{}, func_sym, "func", VariableList{}, &void_type,
|
Function f(Source{}, func_sym, "func", VariableList{}, &void_type,
|
||||||
|
@ -382,7 +382,7 @@ TEST_F(FunctionTest, ToStr_WithDecoration) {
|
||||||
});
|
});
|
||||||
Function f(
|
Function f(
|
||||||
Source{}, func_sym, "func", {}, &void_type, body,
|
Source{}, func_sym, "func", {}, &void_type, body,
|
||||||
FunctionDecorationList{create<WorkgroupDecoration>(2, 4, 6, Source{})});
|
FunctionDecorationList{create<WorkgroupDecoration>(Source{}, 2, 4, 6)});
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
f.to_str(out, 2);
|
f.to_str(out, 2);
|
||||||
|
@ -512,7 +512,7 @@ TEST_F(FunctionTest, WorkgroupSize) {
|
||||||
|
|
||||||
Function f(Source{}, func_sym, "func", {}, &void_type,
|
Function f(Source{}, func_sym, "func", {}, &void_type,
|
||||||
create<BlockStatement>(Source{}, StatementList{}),
|
create<BlockStatement>(Source{}, StatementList{}),
|
||||||
{create<WorkgroupDecoration>(2u, 4u, 6u, Source{})});
|
{create<WorkgroupDecoration>(Source{}, 2u, 4u, 6u)});
|
||||||
|
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
uint32_t y = 0;
|
uint32_t y = 0;
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::LocationDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
LocationDecoration::LocationDecoration(uint32_t val, const Source& source)
|
LocationDecoration::LocationDecoration(const Source& source, uint32_t val)
|
||||||
: Base(source), value_(val) {}
|
: Base(source), value_(val) {}
|
||||||
|
|
||||||
LocationDecoration::~LocationDecoration() = default;
|
LocationDecoration::~LocationDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void LocationDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationDecoration* LocationDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -27,9 +27,9 @@ class LocationDecoration
|
||||||
: public Castable<LocationDecoration, VariableDecoration> {
|
: public Castable<LocationDecoration, VariableDecoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param value the location value
|
|
||||||
/// @param source the source of this decoration
|
/// @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;
|
~LocationDecoration() override;
|
||||||
|
|
||||||
/// @returns the location value
|
/// @returns the location value
|
||||||
|
|
|
@ -26,12 +26,12 @@ namespace {
|
||||||
using LocationDecorationTest = TestHelper;
|
using LocationDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(LocationDecorationTest, Creation) {
|
TEST_F(LocationDecorationTest, Creation) {
|
||||||
LocationDecoration d{2, Source{}};
|
LocationDecoration d{Source{}, 2};
|
||||||
EXPECT_EQ(2u, d.value());
|
EXPECT_EQ(2u, d.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LocationDecorationTest, Is) {
|
TEST_F(LocationDecorationTest, Is) {
|
||||||
LocationDecoration ld{2, Source{}};
|
LocationDecoration ld{Source{}, 2};
|
||||||
Decoration* d = &ld;
|
Decoration* d = &ld;
|
||||||
EXPECT_FALSE(d->Is<BindingDecoration>());
|
EXPECT_FALSE(d->Is<BindingDecoration>());
|
||||||
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
||||||
|
@ -41,7 +41,7 @@ TEST_F(LocationDecorationTest, Is) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(LocationDecorationTest, ToStr) {
|
TEST_F(LocationDecorationTest, ToStr) {
|
||||||
LocationDecoration d{2, Source{}};
|
LocationDecoration d{Source{}, 2};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(LocationDecoration{2}
|
EXPECT_EQ(out.str(), R"(LocationDecoration{2}
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::SetDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
SetDecoration::SetDecoration(uint32_t val, const Source& source)
|
SetDecoration::SetDecoration(const Source& source, uint32_t val)
|
||||||
: Base(source), value_(val) {}
|
: Base(source), value_(val) {}
|
||||||
|
|
||||||
SetDecoration::~SetDecoration() = default;
|
SetDecoration::~SetDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void SetDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDecoration* SetDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -28,7 +28,7 @@ class SetDecoration : public Castable<SetDecoration, VariableDecoration> {
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param value the set value
|
/// @param value the set value
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
SetDecoration(uint32_t value, const Source& source);
|
SetDecoration(const Source& source, uint32_t value);
|
||||||
~SetDecoration() override;
|
~SetDecoration() override;
|
||||||
|
|
||||||
/// @returns the set value
|
/// @returns the set value
|
||||||
|
|
|
@ -24,12 +24,12 @@ namespace {
|
||||||
using SetDecorationTest = TestHelper;
|
using SetDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(SetDecorationTest, Creation) {
|
TEST_F(SetDecorationTest, Creation) {
|
||||||
SetDecoration d{2, Source{}};
|
SetDecoration d{Source{}, 2};
|
||||||
EXPECT_EQ(2u, d.value());
|
EXPECT_EQ(2u, d.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SetDecorationTest, Is) {
|
TEST_F(SetDecorationTest, Is) {
|
||||||
SetDecoration sd{2, Source{}};
|
SetDecoration sd{Source{}, 2};
|
||||||
Decoration* d = &sd;
|
Decoration* d = &sd;
|
||||||
EXPECT_FALSE(d->Is<BindingDecoration>());
|
EXPECT_FALSE(d->Is<BindingDecoration>());
|
||||||
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
EXPECT_FALSE(d->Is<BuiltinDecoration>());
|
||||||
|
@ -39,7 +39,7 @@ TEST_F(SetDecorationTest, Is) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SetDecorationTest, ToStr) {
|
TEST_F(SetDecorationTest, ToStr) {
|
||||||
SetDecoration d{2, Source{}};
|
SetDecoration d{Source{}, 2};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(SetDecoration{2}
|
EXPECT_EQ(out.str(), R"(SetDecoration{2}
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StageDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StageDecoration::StageDecoration(PipelineStage stage, const Source& source)
|
StageDecoration::StageDecoration(const Source& source, PipelineStage stage)
|
||||||
: Base(source), stage_(stage) {}
|
: Base(source), stage_(stage) {}
|
||||||
|
|
||||||
StageDecoration::~StageDecoration() = default;
|
StageDecoration::~StageDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void StageDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
StageDecoration* StageDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -27,7 +27,7 @@ class StageDecoration : public Castable<StageDecoration, FunctionDecoration> {
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param stage the pipeline stage
|
/// @param stage the pipeline stage
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
StageDecoration(PipelineStage stage, const Source& source);
|
StageDecoration(const Source& source, PipelineStage stage);
|
||||||
~StageDecoration() override;
|
~StageDecoration() override;
|
||||||
|
|
||||||
/// @returns the stage
|
/// @returns the stage
|
||||||
|
|
|
@ -26,19 +26,19 @@ namespace {
|
||||||
using StageDecorationTest = TestHelper;
|
using StageDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(StageDecorationTest, Creation_1param) {
|
TEST_F(StageDecorationTest, Creation_1param) {
|
||||||
StageDecoration d{PipelineStage::kFragment, Source{}};
|
StageDecoration d{Source{}, PipelineStage::kFragment};
|
||||||
EXPECT_EQ(d.value(), PipelineStage::kFragment);
|
EXPECT_EQ(d.value(), PipelineStage::kFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StageDecorationTest, Is) {
|
TEST_F(StageDecorationTest, Is) {
|
||||||
StageDecoration sd{PipelineStage::kFragment, Source{}};
|
StageDecoration sd{Source{}, PipelineStage::kFragment};
|
||||||
Decoration* d = &sd;
|
Decoration* d = &sd;
|
||||||
EXPECT_FALSE(d->Is<WorkgroupDecoration>());
|
EXPECT_FALSE(d->Is<WorkgroupDecoration>());
|
||||||
EXPECT_TRUE(d->Is<StageDecoration>());
|
EXPECT_TRUE(d->Is<StageDecoration>());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StageDecorationTest, ToStr) {
|
TEST_F(StageDecorationTest, ToStr) {
|
||||||
StageDecoration d{PipelineStage::kFragment, Source{}};
|
StageDecoration d{Source{}, PipelineStage::kFragment};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(StageDecoration{fragment}
|
EXPECT_EQ(out.str(), R"(StageDecoration{fragment}
|
||||||
|
|
|
@ -22,7 +22,7 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StrideDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StrideDecoration::StrideDecoration(uint32_t stride, const Source& source)
|
StrideDecoration::StrideDecoration(const Source& source, uint32_t stride)
|
||||||
: Base(source), stride_(stride) {}
|
: Base(source), stride_(stride) {}
|
||||||
|
|
||||||
StrideDecoration::~StrideDecoration() = default;
|
StrideDecoration::~StrideDecoration() = default;
|
||||||
|
@ -33,7 +33,7 @@ void StrideDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
StrideDecoration* StrideDecoration::Clone(CloneContext* ctx) 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
|
} // namespace ast
|
||||||
|
|
|
@ -28,7 +28,7 @@ class StrideDecoration : public Castable<StrideDecoration, ArrayDecoration> {
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param stride the stride value
|
/// @param stride the stride value
|
||||||
/// @param source the source of this decoration
|
/// @param source the source of this decoration
|
||||||
StrideDecoration(uint32_t stride, const Source& source);
|
StrideDecoration(const Source& source, uint32_t stride);
|
||||||
~StrideDecoration() override;
|
~StrideDecoration() override;
|
||||||
|
|
||||||
/// @returns the stride value
|
/// @returns the stride value
|
||||||
|
|
|
@ -23,18 +23,18 @@ namespace {
|
||||||
using StrideDecorationTest = TestHelper;
|
using StrideDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(StrideDecorationTest, Creation) {
|
TEST_F(StrideDecorationTest, Creation) {
|
||||||
StrideDecoration d{2, Source{}};
|
StrideDecoration d{Source{}, 2};
|
||||||
EXPECT_EQ(2u, d.stride());
|
EXPECT_EQ(2u, d.stride());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StrideDecorationTest, Is) {
|
TEST_F(StrideDecorationTest, Is) {
|
||||||
StrideDecoration d{2, Source{}};
|
StrideDecoration d{Source{}, 2};
|
||||||
EXPECT_TRUE(d.Is<StrideDecoration>());
|
EXPECT_TRUE(d.Is<StrideDecoration>());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StrideDecorationTest, Source) {
|
TEST_F(StrideDecorationTest, Source) {
|
||||||
StrideDecoration d{
|
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.line, 1u);
|
||||||
EXPECT_EQ(d.source().range.begin.column, 2u);
|
EXPECT_EQ(d.source().range.begin.column, 2u);
|
||||||
EXPECT_EQ(d.source().range.end.line, 3u);
|
EXPECT_EQ(d.source().range.end.line, 3u);
|
||||||
|
|
|
@ -22,8 +22,8 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::StructMemberOffsetDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
StructMemberOffsetDecoration::StructMemberOffsetDecoration(uint32_t offset,
|
StructMemberOffsetDecoration::StructMemberOffsetDecoration(const Source& source,
|
||||||
const Source& source)
|
uint32_t offset)
|
||||||
: Base(source), offset_(offset) {}
|
: Base(source), offset_(offset) {}
|
||||||
|
|
||||||
StructMemberOffsetDecoration::~StructMemberOffsetDecoration() = default;
|
StructMemberOffsetDecoration::~StructMemberOffsetDecoration() = default;
|
||||||
|
@ -36,8 +36,8 @@ void StructMemberOffsetDecoration::to_str(std::ostream& out,
|
||||||
|
|
||||||
StructMemberOffsetDecoration* StructMemberOffsetDecoration::Clone(
|
StructMemberOffsetDecoration* StructMemberOffsetDecoration::Clone(
|
||||||
CloneContext* ctx) const {
|
CloneContext* ctx) const {
|
||||||
return ctx->mod->create<StructMemberOffsetDecoration>(offset_,
|
return ctx->mod->create<StructMemberOffsetDecoration>(ctx->Clone(source()),
|
||||||
ctx->Clone(source()));
|
offset_);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ast
|
} // namespace ast
|
||||||
|
|
|
@ -27,9 +27,9 @@ class StructMemberOffsetDecoration
|
||||||
: public Castable<StructMemberOffsetDecoration, StructMemberDecoration> {
|
: public Castable<StructMemberOffsetDecoration, StructMemberDecoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param offset the offset value
|
|
||||||
/// @param source the source of this decoration
|
/// @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;
|
~StructMemberOffsetDecoration() override;
|
||||||
|
|
||||||
/// @returns the offset value
|
/// @returns the offset value
|
||||||
|
|
|
@ -23,12 +23,12 @@ namespace {
|
||||||
using StructMemberOffsetDecorationTest = TestHelper;
|
using StructMemberOffsetDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(StructMemberOffsetDecorationTest, Creation) {
|
TEST_F(StructMemberOffsetDecorationTest, Creation) {
|
||||||
StructMemberOffsetDecoration d{2, Source{}};
|
StructMemberOffsetDecoration d{Source{}, 2};
|
||||||
EXPECT_EQ(2u, d.offset());
|
EXPECT_EQ(2u, d.offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StructMemberOffsetDecorationTest, Is) {
|
TEST_F(StructMemberOffsetDecorationTest, Is) {
|
||||||
StructMemberOffsetDecoration d{2, Source{}};
|
StructMemberOffsetDecoration d{Source{}, 2};
|
||||||
EXPECT_TRUE(d.Is<StructMemberOffsetDecoration>());
|
EXPECT_TRUE(d.Is<StructMemberOffsetDecoration>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ using StructMemberTest = TestHelper;
|
||||||
TEST_F(StructMemberTest, Creation) {
|
TEST_F(StructMemberTest, Creation) {
|
||||||
type::I32 i32;
|
type::I32 i32;
|
||||||
StructMemberDecorationList decorations;
|
StructMemberDecorationList decorations;
|
||||||
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
|
decorations.emplace_back(create<StructMemberOffsetDecoration>(Source{}, 4));
|
||||||
|
|
||||||
StructMember st{Source{}, "a", &i32, decorations};
|
StructMember st{Source{}, "a", &i32, decorations};
|
||||||
EXPECT_EQ(st.name(), "a");
|
EXPECT_EQ(st.name(), "a");
|
||||||
|
@ -77,7 +77,7 @@ TEST_F(StructMemberTest, IsValid_NullType) {
|
||||||
TEST_F(StructMemberTest, IsValid_Null_Decoration) {
|
TEST_F(StructMemberTest, IsValid_Null_Decoration) {
|
||||||
type::I32 i32;
|
type::I32 i32;
|
||||||
StructMemberDecorationList decorations;
|
StructMemberDecorationList decorations;
|
||||||
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
|
decorations.emplace_back(create<StructMemberOffsetDecoration>(Source{}, 4));
|
||||||
decorations.push_back(nullptr);
|
decorations.push_back(nullptr);
|
||||||
|
|
||||||
StructMember st{Source{}, "a", &i32, decorations};
|
StructMember st{Source{}, "a", &i32, decorations};
|
||||||
|
@ -87,7 +87,7 @@ TEST_F(StructMemberTest, IsValid_Null_Decoration) {
|
||||||
TEST_F(StructMemberTest, ToStr) {
|
TEST_F(StructMemberTest, ToStr) {
|
||||||
type::I32 i32;
|
type::I32 i32;
|
||||||
StructMemberDecorationList decorations;
|
StructMemberDecorationList decorations;
|
||||||
decorations.emplace_back(create<StructMemberOffsetDecoration>(4, Source{}));
|
decorations.emplace_back(create<StructMemberOffsetDecoration>(Source{}, 4));
|
||||||
|
|
||||||
StructMember st{Source{}, "a", &i32, decorations};
|
StructMember st{Source{}, "a", &i32, decorations};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
|
@ -107,7 +107,7 @@ TEST_F(AccessControlTest, MinBufferBindingSizeU32) {
|
||||||
TEST_F(AccessControlTest, MinBufferBindingSizeArray) {
|
TEST_F(AccessControlTest, MinBufferBindingSizeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 4,
|
Array array(&u32, 4,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
||||||
EXPECT_EQ(16u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ TEST_F(AccessControlTest, MinBufferBindingSizeArray) {
|
||||||
TEST_F(AccessControlTest, MinBufferBindingSizeRuntimeArray) {
|
TEST_F(AccessControlTest, MinBufferBindingSizeRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 0,
|
Array array(&u32, 0,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
||||||
EXPECT_EQ(4u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(4u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
||||||
}
|
}
|
||||||
|
@ -125,11 +125,11 @@ TEST_F(AccessControlTest, MinBufferBindingSizeStruct) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
|
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
|
|
||||||
deco = StructMemberDecorationList();
|
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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
|
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -150,7 +150,7 @@ TEST_F(AccessControlTest, BaseAlignmentU32) {
|
||||||
TEST_F(AccessControlTest, BaseAlignmentArray) {
|
TEST_F(AccessControlTest, BaseAlignmentArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 4,
|
Array array(&u32, 4,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
||||||
EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer));
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ TEST_F(AccessControlTest, BaseAlignmentArray) {
|
||||||
TEST_F(AccessControlTest, BaseAlignmentRuntimeArray) {
|
TEST_F(AccessControlTest, BaseAlignmentRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 0,
|
Array array(&u32, 0,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
AccessControl at{ast::AccessControl::kReadOnly, &array};
|
||||||
EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer));
|
||||||
}
|
}
|
||||||
|
@ -169,12 +169,12 @@ TEST_F(AccessControlTest, BaseAlignmentStruct) {
|
||||||
|
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
|
|
@ -175,7 +175,7 @@ TEST_F(AliasTest, MinBufferBindingSizeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 4,
|
Array array(&u32, 4,
|
||||||
ArrayDecorationList{
|
ArrayDecorationList{
|
||||||
create<StrideDecoration>(4, Source{}),
|
create<StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
||||||
EXPECT_EQ(16u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
||||||
|
@ -185,7 +185,7 @@ TEST_F(AliasTest, MinBufferBindingSizeRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 0,
|
Array array(&u32, 0,
|
||||||
ArrayDecorationList{
|
ArrayDecorationList{
|
||||||
create<StrideDecoration>(4, Source{}),
|
create<StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
||||||
EXPECT_EQ(4u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(4u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
||||||
|
@ -197,12 +197,12 @@ TEST_F(AliasTest, MinBufferBindingSizeStruct) {
|
||||||
|
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -224,7 +224,7 @@ TEST_F(AliasTest, BaseAlignmentArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 4,
|
Array array(&u32, 4,
|
||||||
ArrayDecorationList{
|
ArrayDecorationList{
|
||||||
create<StrideDecoration>(4, Source{}),
|
create<StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
||||||
EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer));
|
||||||
|
@ -234,7 +234,7 @@ TEST_F(AliasTest, BaseAlignmentRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array array(&u32, 0,
|
Array array(&u32, 0,
|
||||||
ArrayDecorationList{
|
ArrayDecorationList{
|
||||||
create<StrideDecoration>(4, Source{}),
|
create<StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
Alias alias{mod.RegisterSymbol("alias"), "alias", &array};
|
||||||
EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer));
|
||||||
|
@ -246,12 +246,12 @@ TEST_F(AliasTest, BaseAlignmentStruct) {
|
||||||
|
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
|
|
@ -90,7 +90,7 @@ TEST_F(ArrayTest, TypeName_RuntimeArray) {
|
||||||
TEST_F(ArrayTest, TypeName_WithStride) {
|
TEST_F(ArrayTest, TypeName_WithStride) {
|
||||||
I32 i32;
|
I32 i32;
|
||||||
Array arr{&i32, 3,
|
Array arr{&i32, 3,
|
||||||
ArrayDecorationList{create<StrideDecoration>(16, Source{})}};
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 16)}};
|
||||||
EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16");
|
EXPECT_EQ(arr.type_name(), "__array__i32_3_stride_16");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,21 +103,21 @@ TEST_F(ArrayTest, MinBufferBindingSizeNoStride) {
|
||||||
TEST_F(ArrayTest, MinBufferBindingSizeArray) {
|
TEST_F(ArrayTest, MinBufferBindingSizeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 4,
|
Array arr(&u32, 4,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
EXPECT_EQ(16u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ArrayTest, MinBufferBindingSizeRuntimeArray) {
|
TEST_F(ArrayTest, MinBufferBindingSizeRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 0,
|
Array arr(&u32, 0,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
EXPECT_EQ(4u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(4u, arr.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ArrayTest, BaseAlignmentArray) {
|
TEST_F(ArrayTest, BaseAlignmentArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 4,
|
Array arr(&u32, 4,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer));
|
||||||
EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer));
|
EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer));
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ TEST_F(ArrayTest, BaseAlignmentArray) {
|
||||||
TEST_F(ArrayTest, BaseAlignmentRuntimeArray) {
|
TEST_F(ArrayTest, BaseAlignmentRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 0,
|
Array arr(&u32, 0,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer));
|
EXPECT_EQ(16u, arr.BaseAlignment(MemoryLayout::kUniformBuffer));
|
||||||
EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer));
|
EXPECT_EQ(4u, arr.BaseAlignment(MemoryLayout::kStorageBuffer));
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,12 +83,12 @@ TEST_F(StructTest, MinBufferBindingSize) {
|
||||||
|
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -103,22 +103,22 @@ TEST_F(StructTest, MinBufferBindingSize) {
|
||||||
TEST_F(StructTest, MinBufferBindingSizeArray) {
|
TEST_F(StructTest, MinBufferBindingSizeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 4,
|
Array arr(&u32, 4,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
|
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &arr, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -134,22 +134,22 @@ TEST_F(StructTest, MinBufferBindingSizeArray) {
|
||||||
TEST_F(StructTest, MinBufferBindingSizeRuntimeArray) {
|
TEST_F(StructTest, MinBufferBindingSizeRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 0,
|
Array arr(&u32, 0,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
|
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -167,7 +167,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec2) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &vec2, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -186,7 +186,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec3) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &vec3, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -206,7 +206,7 @@ TEST_F(StructTest, MinBufferBindingSizeVec4) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &vec4, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -225,12 +225,12 @@ TEST_F(StructTest, BaseAlignment) {
|
||||||
|
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -244,22 +244,22 @@ TEST_F(StructTest, BaseAlignment) {
|
||||||
TEST_F(StructTest, BaseAlignmentArray) {
|
TEST_F(StructTest, BaseAlignmentArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 4,
|
Array arr(&u32, 4,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
|
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &arr, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -273,22 +273,22 @@ TEST_F(StructTest, BaseAlignmentArray) {
|
||||||
TEST_F(StructTest, BaseAlignmentRuntimeArray) {
|
TEST_F(StructTest, BaseAlignmentRuntimeArray) {
|
||||||
U32 u32;
|
U32 u32;
|
||||||
Array arr(&u32, 0,
|
Array arr(&u32, 0,
|
||||||
ArrayDecorationList{create<StrideDecoration>(4, Source{})});
|
ArrayDecorationList{create<StrideDecoration>(Source{}, 4)});
|
||||||
|
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
StructMemberDecorationList 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));
|
members.push_back(create<StructMember>(Source{}, "bar", &u32, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -305,7 +305,7 @@ TEST_F(StructTest, BaseAlignmentVec2) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &vec2, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -323,7 +323,7 @@ TEST_F(StructTest, BaseAlignmentVec3) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &vec3, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
@ -341,7 +341,7 @@ TEST_F(StructTest, BaseAlignmentVec4) {
|
||||||
StructMemberList members;
|
StructMemberList members;
|
||||||
{
|
{
|
||||||
StructMemberDecorationList deco;
|
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));
|
members.push_back(create<StructMember>(Source{}, "foo", &vec4, deco));
|
||||||
}
|
}
|
||||||
StructDecorationList decos;
|
StructDecorationList decos;
|
||||||
|
|
|
@ -140,9 +140,9 @@ TEST_F(VariableTest, WithDecorations) {
|
||||||
auto* var = create<Variable>(
|
auto* var = create<Variable>(
|
||||||
Source{}, "my_var", StorageClass::kFunction, &t, false, nullptr,
|
Source{}, "my_var", StorageClass::kFunction, &t, false, nullptr,
|
||||||
VariableDecorationList{
|
VariableDecorationList{
|
||||||
create<LocationDecoration>(1, Source{}),
|
create<LocationDecoration>(Source{}, 1),
|
||||||
create<BuiltinDecoration>(Builtin::kPosition, Source{}),
|
create<BuiltinDecoration>(Source{}, Builtin::kPosition),
|
||||||
create<ConstantIdDecoration>(1200, Source{}),
|
create<ConstantIdDecoration>(Source{}, 1200),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(var->HasLocationDecoration());
|
EXPECT_TRUE(var->HasLocationDecoration());
|
||||||
|
@ -155,7 +155,7 @@ TEST_F(VariableTest, ConstantId) {
|
||||||
auto* var = create<Variable>(Source{}, "my_var", StorageClass::kFunction, &t,
|
auto* var = create<Variable>(Source{}, "my_var", StorageClass::kFunction, &t,
|
||||||
false, nullptr,
|
false, nullptr,
|
||||||
VariableDecorationList{
|
VariableDecorationList{
|
||||||
create<ConstantIdDecoration>(1200, Source{}),
|
create<ConstantIdDecoration>(Source{}, 1200),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_EQ(var->constant_id(), 1200u);
|
EXPECT_EQ(var->constant_id(), 1200u);
|
||||||
|
@ -168,8 +168,8 @@ TEST_F(VariableTest, Decorated_to_str) {
|
||||||
create<IdentifierExpression>(
|
create<IdentifierExpression>(
|
||||||
Source{}, mod.RegisterSymbol("expr"), "expr"),
|
Source{}, mod.RegisterSymbol("expr"), "expr"),
|
||||||
VariableDecorationList{
|
VariableDecorationList{
|
||||||
create<BindingDecoration>(2, Source{}),
|
create<BindingDecoration>(Source{}, 2),
|
||||||
create<SetDecoration>(1, Source{}),
|
create<SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
|
|
|
@ -22,18 +22,18 @@ TINT_INSTANTIATE_CLASS_ID(tint::ast::WorkgroupDecoration);
|
||||||
namespace tint {
|
namespace tint {
|
||||||
namespace ast {
|
namespace ast {
|
||||||
|
|
||||||
WorkgroupDecoration::WorkgroupDecoration(uint32_t x, const Source& source)
|
WorkgroupDecoration::WorkgroupDecoration(const Source& source, uint32_t x)
|
||||||
: Base(source), x_(x) {}
|
: Base(source), x_(x) {}
|
||||||
|
|
||||||
WorkgroupDecoration::WorkgroupDecoration(uint32_t x,
|
WorkgroupDecoration::WorkgroupDecoration(const Source& source,
|
||||||
uint32_t y,
|
uint32_t x,
|
||||||
const Source& source)
|
uint32_t y)
|
||||||
: Base(source), x_(x), y_(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 y,
|
||||||
uint32_t z,
|
uint32_t z)
|
||||||
const Source& source)
|
|
||||||
: Base(source), x_(x), y_(y), z_(z) {}
|
: Base(source), x_(x), y_(y), z_(z) {}
|
||||||
|
|
||||||
WorkgroupDecoration::~WorkgroupDecoration() = default;
|
WorkgroupDecoration::~WorkgroupDecoration() = default;
|
||||||
|
@ -45,8 +45,8 @@ void WorkgroupDecoration::to_str(std::ostream& out, size_t indent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkgroupDecoration* WorkgroupDecoration::Clone(CloneContext* ctx) const {
|
WorkgroupDecoration* WorkgroupDecoration::Clone(CloneContext* ctx) const {
|
||||||
return ctx->mod->create<WorkgroupDecoration>(x_, y_, z_,
|
return ctx->mod->create<WorkgroupDecoration>(ctx->Clone(source()), x_, y_,
|
||||||
ctx->Clone(source()));
|
z_);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ast
|
} // namespace ast
|
||||||
|
|
|
@ -29,20 +29,20 @@ class WorkgroupDecoration
|
||||||
: public Castable<WorkgroupDecoration, FunctionDecoration> {
|
: public Castable<WorkgroupDecoration, FunctionDecoration> {
|
||||||
public:
|
public:
|
||||||
/// constructor
|
/// constructor
|
||||||
/// @param x the workgroup x dimension size
|
|
||||||
/// @param source the source of this decoration
|
/// @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
|
/// constructor
|
||||||
|
/// @param source the source of this decoration
|
||||||
/// @param x the workgroup x dimension size
|
/// @param x the workgroup x dimension size
|
||||||
/// @param y the workgroup x dimension size
|
/// @param y the workgroup x dimension size
|
||||||
/// @param source the source of this decoration
|
WorkgroupDecoration(const Source& source, uint32_t x, uint32_t y);
|
||||||
WorkgroupDecoration(uint32_t x, uint32_t y, const Source& source);
|
|
||||||
/// constructor
|
/// constructor
|
||||||
|
/// @param source the source of this decoration
|
||||||
/// @param x the workgroup x dimension size
|
/// @param x the workgroup x dimension size
|
||||||
/// @param y the workgroup x dimension size
|
/// @param y the workgroup x dimension size
|
||||||
/// @param z the workgroup x dimension size
|
/// @param z the workgroup x dimension size
|
||||||
/// @param source the source of this decoration
|
WorkgroupDecoration(const Source& source, uint32_t x, uint32_t y, uint32_t z);
|
||||||
WorkgroupDecoration(uint32_t x, uint32_t y, uint32_t z, const Source& source);
|
|
||||||
~WorkgroupDecoration() override;
|
~WorkgroupDecoration() override;
|
||||||
|
|
||||||
/// @returns the workgroup dimensions
|
/// @returns the workgroup dimensions
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace {
|
||||||
using WorkgroupDecorationTest = TestHelper;
|
using WorkgroupDecorationTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(WorkgroupDecorationTest, Creation_1param) {
|
TEST_F(WorkgroupDecorationTest, Creation_1param) {
|
||||||
WorkgroupDecoration d{2, Source{}};
|
WorkgroupDecoration d{Source{}, 2};
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
uint32_t y = 0;
|
uint32_t y = 0;
|
||||||
uint32_t z = 0;
|
uint32_t z = 0;
|
||||||
|
@ -36,7 +36,7 @@ TEST_F(WorkgroupDecorationTest, Creation_1param) {
|
||||||
EXPECT_EQ(z, 1u);
|
EXPECT_EQ(z, 1u);
|
||||||
}
|
}
|
||||||
TEST_F(WorkgroupDecorationTest, Creation_2param) {
|
TEST_F(WorkgroupDecorationTest, Creation_2param) {
|
||||||
WorkgroupDecoration d{2, 4, Source{}};
|
WorkgroupDecoration d{Source{}, 2, 4};
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
uint32_t y = 0;
|
uint32_t y = 0;
|
||||||
uint32_t z = 0;
|
uint32_t z = 0;
|
||||||
|
@ -47,7 +47,7 @@ TEST_F(WorkgroupDecorationTest, Creation_2param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WorkgroupDecorationTest, Creation_3param) {
|
TEST_F(WorkgroupDecorationTest, Creation_3param) {
|
||||||
WorkgroupDecoration d{2, 4, 6, Source{}};
|
WorkgroupDecoration d{Source{}, 2, 4, 6};
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
uint32_t y = 0;
|
uint32_t y = 0;
|
||||||
uint32_t z = 0;
|
uint32_t z = 0;
|
||||||
|
@ -58,14 +58,14 @@ TEST_F(WorkgroupDecorationTest, Creation_3param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WorkgroupDecorationTest, Is) {
|
TEST_F(WorkgroupDecorationTest, Is) {
|
||||||
WorkgroupDecoration wd{2, 4, 6, Source{}};
|
WorkgroupDecoration wd{Source{}, 2, 4, 6};
|
||||||
Decoration* d = &wd;
|
Decoration* d = &wd;
|
||||||
EXPECT_TRUE(d->Is<WorkgroupDecoration>());
|
EXPECT_TRUE(d->Is<WorkgroupDecoration>());
|
||||||
EXPECT_FALSE(d->Is<StageDecoration>());
|
EXPECT_FALSE(d->Is<StageDecoration>());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WorkgroupDecorationTest, ToStr) {
|
TEST_F(WorkgroupDecorationTest, ToStr) {
|
||||||
WorkgroupDecoration d{2, 4, 6, Source{}};
|
WorkgroupDecoration d{Source{}, 2, 4, 6};
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
d.to_str(out, 0);
|
d.to_str(out, 0);
|
||||||
EXPECT_EQ(out.str(), R"(WorkgroupDecoration{2 4 6}
|
EXPECT_EQ(out.str(), R"(WorkgroupDecoration{2 4 6}
|
||||||
|
|
|
@ -231,7 +231,7 @@ class InspectorHelper {
|
||||||
constructor, // constructor
|
constructor, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(id, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, id),
|
||||||
});
|
});
|
||||||
mod()->AddGlobalVariable(var);
|
mod()->AddGlobalVariable(var);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ class InspectorHelper {
|
||||||
|
|
||||||
ast::StructMemberDecorationList deco;
|
ast::StructMemberDecorationList deco;
|
||||||
deco.push_back(
|
deco.push_back(
|
||||||
create<ast::StructMemberOffsetDecoration>(offset, Source{}));
|
create<ast::StructMemberOffsetDecoration>(Source{}, offset));
|
||||||
|
|
||||||
members.push_back(create<ast::StructMember>(
|
members.push_back(create<ast::StructMember>(
|
||||||
Source{}, StructMemberName(members.size(), type), type, deco));
|
Source{}, StructMemberName(members.size(), type), type, deco));
|
||||||
|
@ -394,8 +394,8 @@ class InspectorHelper {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(binding, Source{}),
|
create<ast::BindingDecoration>(Source{}, binding),
|
||||||
create<ast::SetDecoration>(set, Source{}),
|
create<ast::SetDecoration>(Source{}, set),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod()->AddGlobalVariable(var);
|
mod()->AddGlobalVariable(var);
|
||||||
|
@ -801,7 +801,7 @@ class InspectorHelper {
|
||||||
array_type_memo_[count] = create<ast::type::Array>(
|
array_type_memo_[count] = create<ast::type::Array>(
|
||||||
u32_type(), count,
|
u32_type(), count,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(4, Source{}),
|
create<ast::StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return array_type_memo_[count];
|
return array_type_memo_[count];
|
||||||
|
@ -915,7 +915,7 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) {
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -934,14 +934,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
auto* bar = MakeEmptyBodyFunction(
|
auto* bar = MakeEmptyBodyFunction(
|
||||||
"bar",
|
"bar",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(bar);
|
mod()->AddFunction(bar);
|
||||||
|
|
||||||
|
@ -966,14 +966,14 @@ TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
auto* bar = MakeCallerBodyFunction(
|
auto* bar = MakeCallerBodyFunction(
|
||||||
"bar", "func",
|
"bar", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(bar);
|
mod()->AddFunction(bar);
|
||||||
|
|
||||||
|
@ -995,7 +995,7 @@ TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) {
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1014,8 +1014,8 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) {
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
create<ast::WorkgroupDecoration>(8u, 2u, 1u, Source{}),
|
create<ast::WorkgroupDecoration>(Source{}, 8u, 2u, 1u),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1037,7 +1037,7 @@ TEST_F(InspectorGetEntryPointTest, NoInOutVariables) {
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointInOutVariables) {
|
||||||
auto* foo = MakeInOutVariableBodyFunction(
|
auto* foo = MakeInOutVariableBodyFunction(
|
||||||
"foo", {{"in_var", "out_var"}},
|
"foo", {{"in_var", "out_var"}},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1081,7 +1081,7 @@ TEST_F(InspectorGetEntryPointTest, FunctionInOutVariables) {
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1107,7 +1107,7 @@ TEST_F(InspectorGetEntryPointTest, RepeatedInOutVariables) {
|
||||||
auto* foo = MakeInOutVariableCallerBodyFunction(
|
auto* foo = MakeInOutVariableCallerBodyFunction(
|
||||||
"foo", "func", {{"in_var", "out_var"}},
|
"foo", "func", {{"in_var", "out_var"}},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1130,7 +1130,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointMultipleInOutVariables) {
|
||||||
auto* foo = MakeInOutVariableBodyFunction(
|
auto* foo = MakeInOutVariableBodyFunction(
|
||||||
"foo", {{"in_var", "out_var"}, {"in2_var", "out2_var"}},
|
"foo", {{"in_var", "out_var"}, {"in2_var", "out2_var"}},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1159,7 +1159,7 @@ TEST_F(InspectorGetEntryPointTest, FunctionMultipleInOutVariables) {
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1184,14 +1184,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) {
|
||||||
auto* foo = MakeInOutVariableBodyFunction(
|
auto* foo = MakeInOutVariableBodyFunction(
|
||||||
"foo", {{"in_var", "out2_var"}},
|
"foo", {{"in_var", "out2_var"}},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
auto* bar = MakeInOutVariableBodyFunction(
|
auto* bar = MakeInOutVariableBodyFunction(
|
||||||
"bar", {{"in2_var", "out_var"}},
|
"bar", {{"in2_var", "out_var"}},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(bar);
|
mod()->AddFunction(bar);
|
||||||
|
|
||||||
|
@ -1228,14 +1228,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsSharedInOutVariables) {
|
||||||
auto* foo = MakeInOutVariableCallerBodyFunction(
|
auto* foo = MakeInOutVariableCallerBodyFunction(
|
||||||
"foo", "func", {{"in_var", "out_var"}},
|
"foo", "func", {{"in_var", "out_var"}},
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
auto* bar = MakeCallerBodyFunction(
|
auto* bar = MakeCallerBodyFunction(
|
||||||
"bar", "func",
|
"bar", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(bar);
|
mod()->AddFunction(bar);
|
||||||
|
|
||||||
|
@ -1291,7 +1291,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_OneEntryPoint) {
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1310,7 +1310,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest,
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -1319,7 +1319,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest,
|
||||||
auto* bar = MakeEmptyBodyFunction(
|
auto* bar = MakeEmptyBodyFunction(
|
||||||
"bar",
|
"bar",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(bar);
|
mod()->AddFunction(bar);
|
||||||
|
|
||||||
|
@ -1444,7 +1444,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "ub_func",
|
"ep_func", "ub_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1458,7 +1458,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) {
|
||||||
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) {
|
TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) {
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList deco;
|
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>(
|
members.push_back(create<ast::StructMember>(
|
||||||
Source{}, StructMemberName(members.size(), i32_type()), i32_type(),
|
Source{}, StructMemberName(members.size(), i32_type()), i32_type(),
|
||||||
|
@ -1479,7 +1479,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "ub_func",
|
"ep_func", "ub_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1504,7 +1504,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "ub_func",
|
"ep_func", "ub_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1533,7 +1533,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "ub_func",
|
"ep_func", "ub_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1587,7 +1587,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) {
|
||||||
Source{}, mod()->RegisterSymbol("ep_func"), "ep_func",
|
Source{}, mod()->RegisterSymbol("ep_func"), "ep_func",
|
||||||
ast::VariableList(), void_type(), body,
|
ast::VariableList(), void_type(), body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -1624,7 +1624,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "ub_func",
|
"ep_func", "ub_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1653,7 +1653,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1682,7 +1682,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1736,7 +1736,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) {
|
||||||
Source{}, mod()->RegisterSymbol("ep_func"), "ep_func",
|
Source{}, mod()->RegisterSymbol("ep_func"), "ep_func",
|
||||||
ast::VariableList(), void_type(), body,
|
ast::VariableList(), void_type(), body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -1773,7 +1773,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1802,7 +1802,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1831,7 +1831,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1856,7 +1856,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1912,7 +1912,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest,
|
||||||
Source{}, mod()->RegisterSymbol("ep_func"), "ep_func",
|
Source{}, mod()->RegisterSymbol("ep_func"), "ep_func",
|
||||||
ast::VariableList(), void_type(), body,
|
ast::VariableList(), void_type(), body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -1950,7 +1950,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -1981,7 +1981,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest,
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -2011,7 +2011,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "sb_func",
|
"ep_func", "sb_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -2033,7 +2033,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) {
|
||||||
auto* func = MakeSamplerReferenceBodyFunction(
|
auto* func = MakeSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(),
|
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2051,7 +2051,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) {
|
||||||
auto* func = MakeEmptyBodyFunction(
|
auto* func = MakeEmptyBodyFunction(
|
||||||
"ep_func",
|
"ep_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2077,7 +2077,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "foo_func",
|
"ep_func", "foo_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -2101,7 +2101,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
auto* func = MakeSamplerReferenceBodyFunction(
|
auto* func = MakeSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(),
|
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2122,7 +2122,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
||||||
auto* func = MakeComparisonSamplerReferenceBodyFunction(
|
auto* func = MakeComparisonSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(),
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2145,7 +2145,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) {
|
||||||
auto* func = MakeComparisonSamplerReferenceBodyFunction(
|
auto* func = MakeComparisonSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(),
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2163,7 +2163,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) {
|
||||||
auto* func = MakeEmptyBodyFunction(
|
auto* func = MakeEmptyBodyFunction(
|
||||||
"ep_func",
|
"ep_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2191,7 +2191,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
||||||
auto* ep_func = MakeCallerBodyFunction(
|
auto* ep_func = MakeCallerBodyFunction(
|
||||||
"ep_func", "foo_func",
|
"ep_func", "foo_func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(ep_func);
|
mod()->AddFunction(ep_func);
|
||||||
|
|
||||||
|
@ -2216,7 +2216,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
auto* func = MakeComparisonSamplerReferenceBodyFunction(
|
auto* func = MakeComparisonSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(),
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_depth", f32_type(),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2236,7 +2236,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) {
|
||||||
auto* func = MakeSamplerReferenceBodyFunction(
|
auto* func = MakeSamplerReferenceBodyFunction(
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(),
|
"ep", "foo_texture", "foo_sampler", "foo_coords", f32_type(),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2252,7 +2252,7 @@ TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) {
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -2275,7 +2275,7 @@ TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) {
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords",
|
"ep", "foo_texture", "foo_sampler", "foo_coords",
|
||||||
GetBaseType(GetParam().sampled_kind),
|
GetBaseType(GetParam().sampled_kind),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2359,7 +2359,7 @@ TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam,
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
||||||
GetBaseType(GetParam().sampled_kind),
|
GetBaseType(GetParam().sampled_kind),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2430,7 +2430,7 @@ TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords",
|
"ep", "foo_texture", "foo_sampler", "foo_coords",
|
||||||
GetBaseType(GetParam().sampled_kind),
|
GetBaseType(GetParam().sampled_kind),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -2479,7 +2479,7 @@ TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) {
|
||||||
auto* foo = MakeEmptyBodyFunction(
|
auto* foo = MakeEmptyBodyFunction(
|
||||||
"foo",
|
"foo",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(foo);
|
mod()->AddFunction(foo);
|
||||||
|
|
||||||
|
@ -2504,7 +2504,7 @@ TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam,
|
||||||
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
"ep", "foo_texture", "foo_sampler", "foo_coords", "foo_array_index",
|
||||||
GetBaseType(GetParam().sampled_kind),
|
GetBaseType(GetParam().sampled_kind),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
|
|
@ -906,7 +906,7 @@ bool FunctionEmitter::ParseFunctionDeclaration(FunctionDeclaration* decl) {
|
||||||
}
|
}
|
||||||
ast::FunctionDecorationList decos;
|
ast::FunctionDecorationList decos;
|
||||||
if (ep_info_ != nullptr) {
|
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;
|
decl->name = name;
|
||||||
|
|
|
@ -447,7 +447,7 @@ ast::StructMemberDecoration* ParserImpl::ConvertMemberDecoration(
|
||||||
<< ShowType(struct_type_id);
|
<< ShowType(struct_type_id);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return create<ast::StructMemberOffsetDecoration>(decoration[1], Source{});
|
return create<ast::StructMemberOffsetDecoration>(Source{}, decoration[1]);
|
||||||
case SpvDecorationNonReadable:
|
case SpvDecorationNonReadable:
|
||||||
// WGSL doesn't have a member decoration for this. Silently drop it.
|
// WGSL doesn't have a member decoration for this. Silently drop it.
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -845,7 +845,7 @@ bool ParserImpl::ParseArrayDecorations(
|
||||||
<< ": multiple ArrayStride decorations";
|
<< ": multiple ArrayStride decorations";
|
||||||
}
|
}
|
||||||
has_array_stride = true;
|
has_array_stride = true;
|
||||||
decorations->push_back(create<ast::StrideDecoration>(stride, Source{}));
|
decorations->push_back(create<ast::StrideDecoration>(Source{}, stride));
|
||||||
} else {
|
} else {
|
||||||
return Fail() << "invalid array type ID " << type_id
|
return Fail() << "invalid array type ID " << type_id
|
||||||
<< ": unknown decoration "
|
<< ": unknown decoration "
|
||||||
|
@ -1072,7 +1072,7 @@ bool ParserImpl::EmitScalarSpecConstants() {
|
||||||
ast::VariableDecorationList spec_id_decos;
|
ast::VariableDecorationList spec_id_decos;
|
||||||
for (const auto& deco : GetDecorationsFor(inst.result_id())) {
|
for (const auto& deco : GetDecorationsFor(inst.result_id())) {
|
||||||
if ((deco.size() == 2) && (deco[0] == SpvDecorationSpecId)) {
|
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);
|
spec_id_decos.push_back(cid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1210,7 @@ bool ParserImpl::EmitModuleScopeVariables() {
|
||||||
enum_converter_.ToStorageClass(builtin_position_.storage_class),
|
enum_converter_.ToStorageClass(builtin_position_.storage_class),
|
||||||
ConvertType(builtin_position_.member_type_id), false, nullptr,
|
ConvertType(builtin_position_.member_type_id), false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
|
||||||
});
|
});
|
||||||
|
|
||||||
ast_module_.AddGlobalVariable(var);
|
ast_module_.AddGlobalVariable(var);
|
||||||
|
@ -1255,7 +1255,7 @@ ast::Variable* ParserImpl::MakeVariable(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
decorations.emplace_back(
|
decorations.emplace_back(
|
||||||
create<ast::BuiltinDecoration>(ast_builtin, Source{}));
|
create<ast::BuiltinDecoration>(Source{}, ast_builtin));
|
||||||
}
|
}
|
||||||
if (deco[0] == SpvDecorationLocation) {
|
if (deco[0] == SpvDecorationLocation) {
|
||||||
if (deco.size() != 2) {
|
if (deco.size() != 2) {
|
||||||
|
@ -1264,7 +1264,7 @@ ast::Variable* ParserImpl::MakeVariable(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
decorations.emplace_back(
|
decorations.emplace_back(
|
||||||
create<ast::LocationDecoration>(deco[1], Source{}));
|
create<ast::LocationDecoration>(Source{}, deco[1]));
|
||||||
}
|
}
|
||||||
if (deco[0] == SpvDecorationDescriptorSet) {
|
if (deco[0] == SpvDecorationDescriptorSet) {
|
||||||
if (deco.size() == 1) {
|
if (deco.size() == 1) {
|
||||||
|
@ -1272,7 +1272,7 @@ ast::Variable* ParserImpl::MakeVariable(
|
||||||
<< ": has no operand";
|
<< ": has no operand";
|
||||||
return nullptr;
|
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[0] == SpvDecorationBinding) {
|
||||||
if (deco.size() == 1) {
|
if (deco.size() == 1) {
|
||||||
|
@ -1281,7 +1281,7 @@ ast::Variable* ParserImpl::MakeVariable(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
decorations.emplace_back(
|
decorations.emplace_back(
|
||||||
create<ast::BindingDecoration>(deco[1], Source{}));
|
create<ast::BindingDecoration>(Source{}, deco[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2865,7 +2865,7 @@ Maybe<ast::Decoration*> ParserImpl::decoration() {
|
||||||
if (val.errored)
|
if (val.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (val.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (val.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (val.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (builtin.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (stage.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (val.errored)
|
||||||
return Failure::kErrored;
|
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)
|
if (val.errored)
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
|
|
||||||
return create<ast::StructMemberOffsetDecoration>(val.value, t.source());
|
return create<ast::StructMemberOffsetDecoration>(t.source(), val.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
mod->create<ast::BuiltinDecoration>(
|
mod->create<ast::BuiltinDecoration>(
|
||||||
ast::Builtin::kPointSize, Source{}),
|
Source{}, ast::Builtin::kPointSize),
|
||||||
});
|
});
|
||||||
mod->AddGlobalVariable(pointsize_var);
|
mod->AddGlobalVariable(pointsize_var);
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageBasic) {
|
||||||
auto* entry = create<ast::Function>(
|
auto* entry = create<ast::Function>(
|
||||||
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_, block,
|
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_, block,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->AddFunction(entry);
|
mod->AddFunction(entry);
|
||||||
|
|
||||||
|
@ -141,8 +141,8 @@ TEST_F(EmitVertexPointSizeTest, VertexStageEmpty) {
|
||||||
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_,
|
Source{}, entry_sym, "entry", ast::VariableList{}, ty.void_,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kVertex),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
auto b_sym = mod->RegisterSymbol("non_entry_b");
|
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_,
|
Source{}, frag_sym, "fragment_entry", ast::VariableList{}, ty.void_,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
mod->AddFunction(fragment_entry);
|
mod->AddFunction(fragment_entry);
|
||||||
|
|
||||||
|
@ -207,8 +207,8 @@ TEST_F(EmitVertexPointSizeTest, NonVertexStage) {
|
||||||
Source{}, comp_sym, "compute_entry", ast::VariableList{}, ty.void_,
|
Source{}, comp_sym, "compute_entry", ast::VariableList{}, ty.void_,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod->AddFunction(compute_entry);
|
mod->AddFunction(compute_entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
|
||||||
if (has_vertex_index_) {
|
if (has_vertex_index_) {
|
||||||
ast::StructMemberDecorationList member_dec;
|
ast::StructMemberDecorationList member_dec;
|
||||||
member_dec.push_back(
|
member_dec.push_back(
|
||||||
mod->create<ast::StructMemberOffsetDecoration>(offset, Source{}));
|
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
|
||||||
members.push_back(mod->create<ast::StructMember>(
|
members.push_back(mod->create<ast::StructMember>(
|
||||||
Source{}, kFirstVertexName, u32_type, std::move(member_dec)));
|
Source{}, kFirstVertexName, u32_type, std::move(member_dec)));
|
||||||
vertex_index_offset_ = offset;
|
vertex_index_offset_ = offset;
|
||||||
|
@ -207,7 +207,7 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
|
||||||
if (has_instance_index_) {
|
if (has_instance_index_) {
|
||||||
ast::StructMemberDecorationList member_dec;
|
ast::StructMemberDecorationList member_dec;
|
||||||
member_dec.push_back(
|
member_dec.push_back(
|
||||||
mod->create<ast::StructMemberOffsetDecoration>(offset, Source{}));
|
mod->create<ast::StructMemberOffsetDecoration>(Source{}, offset));
|
||||||
members.push_back(mod->create<ast::StructMember>(
|
members.push_back(mod->create<ast::StructMember>(
|
||||||
Source{}, kFirstInstanceName, u32_type, std::move(member_dec)));
|
Source{}, kFirstInstanceName, u32_type, std::move(member_dec)));
|
||||||
instance_index_offset_ = offset;
|
instance_index_offset_ = offset;
|
||||||
|
@ -229,8 +229,8 @@ ast::Variable* FirstIndexOffset::AddUniformBuffer(ast::Module* mod) {
|
||||||
false, // is_const
|
false, // is_const
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
mod->create<ast::BindingDecoration>(binding_, Source{}),
|
mod->create<ast::BindingDecoration>(Source{}, binding_),
|
||||||
mod->create<ast::SetDecoration>(set_, Source{}),
|
mod->create<ast::SetDecoration>(Source{}, set_),
|
||||||
}); // decorations
|
}); // decorations
|
||||||
|
|
||||||
mod->AddGlobalVariable(idx_var);
|
mod->AddGlobalVariable(idx_var);
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct ModuleBuilder : public ast::BuilderWithModule {
|
||||||
void AddBuiltinInput(const std::string& name, ast::Builtin builtin) {
|
void AddBuiltinInput(const std::string& name, ast::Builtin builtin) {
|
||||||
mod->AddGlobalVariable(
|
mod->AddGlobalVariable(
|
||||||
Var(name, ast::StorageClass::kInput, ty.u32, nullptr,
|
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,
|
ast::Function* AddFunction(const std::string& name,
|
||||||
|
|
|
@ -173,7 +173,7 @@ void VertexPulling::State::FindOrInsertVertexIndexIfUsed() {
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
out->create<ast::BuiltinDecoration>(
|
out->create<ast::BuiltinDecoration>(
|
||||||
ast::Builtin::kVertexIdx, Source{}),
|
Source{}, ast::Builtin::kVertexIdx),
|
||||||
});
|
});
|
||||||
|
|
||||||
out->AddGlobalVariable(var);
|
out->AddGlobalVariable(var);
|
||||||
|
@ -220,7 +220,7 @@ void VertexPulling::State::FindOrInsertInstanceIndexIfUsed() {
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
out->create<ast::BuiltinDecoration>(
|
out->create<ast::BuiltinDecoration>(
|
||||||
ast::Builtin::kInstanceIdx, Source{}),
|
Source{}, ast::Builtin::kInstanceIdx),
|
||||||
});
|
});
|
||||||
out->AddGlobalVariable(var);
|
out->AddGlobalVariable(var);
|
||||||
}
|
}
|
||||||
|
@ -258,14 +258,14 @@ void VertexPulling::State::AddVertexStorageBuffers() {
|
||||||
auto* internal_array_type = out->create<ast::type::Array>(
|
auto* internal_array_type = out->create<ast::type::Array>(
|
||||||
GetU32Type(), 0,
|
GetU32Type(), 0,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
out->create<ast::StrideDecoration>(4u, Source{}),
|
out->create<ast::StrideDecoration>(Source{}, 4u),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Creating the struct type
|
// Creating the struct type
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList member_dec;
|
ast::StructMemberDecorationList member_dec;
|
||||||
member_dec.push_back(
|
member_dec.push_back(
|
||||||
out->create<ast::StructMemberOffsetDecoration>(0u, Source{}));
|
out->create<ast::StructMemberOffsetDecoration>(Source{}, 0u));
|
||||||
|
|
||||||
members.push_back(out->create<ast::StructMember>(
|
members.push_back(out->create<ast::StructMember>(
|
||||||
Source{}, kStructBufferName, internal_array_type, std::move(member_dec)));
|
Source{}, kStructBufferName, internal_array_type, std::move(member_dec)));
|
||||||
|
@ -288,8 +288,8 @@ void VertexPulling::State::AddVertexStorageBuffers() {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
out->create<ast::BindingDecoration>(i, Source{}),
|
out->create<ast::BindingDecoration>(Source{}, i),
|
||||||
out->create<ast::SetDecoration>(cfg.pulling_set, Source{}),
|
out->create<ast::SetDecoration>(Source{}, cfg.pulling_set),
|
||||||
});
|
});
|
||||||
out->AddGlobalVariable(var);
|
out->AddGlobalVariable(var);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class VertexPullingHelper {
|
||||||
mod_->create<ast::type::Void>(),
|
mod_->create<ast::type::Void>(),
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
||||||
ast::PipelineStage::kVertex, Source{})});
|
Source{}, ast::PipelineStage::kVertex)});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class VertexPullingHelper {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(location, Source{}),
|
create<ast::LocationDecoration>(Source{}, location),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod_->AddGlobalVariable(var);
|
mod_->AddGlobalVariable(var);
|
||||||
|
@ -139,7 +139,7 @@ TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
|
||||||
mod()->create<ast::type::Void>(),
|
mod()->create<ast::type::Void>(),
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kVertexIdx, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kVertexIdx),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
mod()->AddGlobalVariable(create<ast::Variable>(
|
mod()->AddGlobalVariable(create<ast::Variable>(
|
||||||
|
@ -449,7 +449,7 @@ TEST_F(VertexPullingTest, ExistingVertexIndexAndInstanceIndex) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kInstanceIdx, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kInstanceIdx),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
InitTransform(
|
InitTransform(
|
||||||
|
|
|
@ -5338,7 +5338,7 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) {
|
||||||
auto* ep_1 = create<ast::Function>(
|
auto* ep_1 = create<ast::Function>(
|
||||||
Source{}, mod->RegisterSymbol("ep_1"), "ep_1", params, &f32, body,
|
Source{}, mod->RegisterSymbol("ep_1"), "ep_1", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
body = create<ast::BlockStatement>(
|
body = create<ast::BlockStatement>(
|
||||||
|
@ -5356,7 +5356,7 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) {
|
||||||
auto* ep_2 = create<ast::Function>(
|
auto* ep_2 = create<ast::Function>(
|
||||||
Source{}, mod->RegisterSymbol("ep_2"), "ep_2", params, &f32, body,
|
Source{}, mod->RegisterSymbol("ep_2"), "ep_2", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->AddFunction(func_b);
|
mod->AddFunction(func_b);
|
||||||
|
|
|
@ -60,7 +60,7 @@ TEST_F(ValidateFunctionTest, VoidFunctionEndWithoutReturnStatement_Pass) {
|
||||||
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("func"), "func",
|
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("func"), "func",
|
||||||
params, &void_type, body,
|
params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ TEST_F(ValidateFunctionTest,
|
||||||
params, &void_type,
|
params, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_Pass) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body,
|
Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_NotVoid_Fail) {
|
||||||
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("vtx_main"),
|
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("vtx_main"),
|
||||||
"vtx_main", params, &i32, body,
|
"vtx_main", params, &i32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
@ -361,7 +361,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_WithParams_Fail) {
|
||||||
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("vtx_func"),
|
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("vtx_func"),
|
||||||
"vtx_func", params, &void_type, body,
|
"vtx_func", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
@ -386,8 +386,8 @@ TEST_F(ValidateFunctionTest, PipelineStage_MustBeUnique_Fail) {
|
||||||
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("main"), "main",
|
Source{Source::Location{12, 34}}, mod()->RegisterSymbol("main"), "main",
|
||||||
params, &void_type, body,
|
params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
@ -411,7 +411,7 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Pass) {
|
||||||
Source{}, mod()->RegisterSymbol("vtx_func"), "vtx_func", params,
|
Source{}, mod()->RegisterSymbol("vtx_func"), "vtx_func", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) {
|
||||||
Source{}, mod()->RegisterSymbol("my_func"), "my_func", params, &void_type,
|
Source{}, mod()->RegisterSymbol("my_func"), "my_func", params, &void_type,
|
||||||
body,
|
body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
@ -848,7 +848,7 @@ TEST_F(ValidatorTest, RedeclaredIdentifierDifferentFunctions_Pass) {
|
||||||
Source{}, mod()->RegisterSymbol("func1"), "func1", params1, &void_type,
|
Source{}, mod()->RegisterSymbol("func1"), "func1", params1, &void_type,
|
||||||
body1,
|
body1,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod()->AddFunction(func0);
|
mod()->AddFunction(func0);
|
||||||
|
|
|
@ -211,7 +211,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayInFunction_Fail) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body,
|
Source{}, mod()->RegisterSymbol("func"), "func", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod()->AddFunction(func);
|
mod()->AddFunction(func);
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ TEST_F(HlslGeneratorImplTest_Alias, EmitAlias_Struct) {
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &i32,
|
Source{}, "b", &i32,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -100,7 +100,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -139,7 +139,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -151,7 +151,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -180,7 +180,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -219,7 +219,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -231,7 +231,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -260,7 +260,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -299,7 +299,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -311,7 +311,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -339,7 +339,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -375,7 +375,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -387,7 +387,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -415,7 +415,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -446,7 +446,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -458,7 +458,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -486,7 +486,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -524,7 +524,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* depth_var = create<ast::Variable>(
|
auto* depth_var = create<ast::Variable>(
|
||||||
|
@ -536,7 +536,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -562,7 +562,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
|
@ -153,7 +153,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -165,7 +165,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -189,7 +189,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -228,7 +228,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* depth_var = create<ast::Variable>(
|
auto* depth_var = create<ast::Variable>(
|
||||||
|
@ -240,7 +240,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -268,7 +268,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -307,8 +307,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -338,7 +338,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -381,8 +381,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddConstructedType(&s);
|
mod.AddConstructedType(&s);
|
||||||
|
@ -418,7 +418,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -447,11 +447,11 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -469,8 +469,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -500,7 +500,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -525,11 +525,11 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -547,8 +547,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -578,7 +578,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -603,11 +603,11 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -625,8 +625,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -653,7 +653,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main",
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main",
|
||||||
ast::VariableList{}, &void_type, body,
|
ast::VariableList{}, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -685,7 +685,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -697,7 +697,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* val_var =
|
auto* val_var =
|
||||||
|
@ -709,7 +709,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -776,7 +776,7 @@ TEST_F(
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -822,7 +822,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(depth_var);
|
td.RegisterVariableForTesting(depth_var);
|
||||||
|
@ -873,7 +873,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -913,7 +913,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* depth_var = create<ast::Variable>(
|
auto* depth_var = create<ast::Variable>(
|
||||||
|
@ -925,7 +925,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -988,7 +988,7 @@ TEST_F(
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -1032,8 +1032,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -1095,7 +1095,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1133,8 +1133,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -1196,7 +1196,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1232,7 +1232,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(bar_var);
|
td.RegisterVariableForTesting(bar_var);
|
||||||
|
@ -1268,7 +1268,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -1300,7 +1300,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
ast::VariableList{}, &void_type,
|
ast::VariableList{}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1325,7 +1325,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1353,8 +1353,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
|
create<ast::WorkgroupDecoration>(Source{}, 2u, 4u, 6u),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1427,7 +1427,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
|
||||||
|
|
||||||
ast::StructDecorationList s_decos;
|
ast::StructDecorationList s_decos;
|
||||||
|
@ -1447,8 +1447,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(0, Source{}),
|
create<ast::SetDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddConstructedType(&s);
|
mod.AddConstructedType(&s);
|
||||||
|
@ -1480,8 +1480,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1512,8 +1512,8 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
|
@ -50,7 +50,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, EmitExpression_MemberAccessor) {
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "mem", &f32, deco));
|
||||||
|
|
||||||
auto* strct =
|
auto* strct =
|
||||||
|
@ -98,11 +98,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -152,11 +152,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -213,11 +213,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "z", &i32,
|
Source{}, "z", &i32,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &mat,
|
Source{}, "a", &mat,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -288,11 +288,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -353,11 +353,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -414,11 +414,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -471,7 +471,7 @@ TEST_F(
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -524,11 +524,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "z", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &mat, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -584,12 +584,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
ast::type::I32 i32;
|
ast::type::I32 i32;
|
||||||
ast::type::Array ary(&i32, 5,
|
ast::type::Array ary(&i32, 5,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(4, Source{}),
|
create<ast::StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &ary, a_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -641,12 +641,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
ast::type::I32 i32;
|
ast::type::I32 i32;
|
||||||
ast::type::Array ary(&i32, 5,
|
ast::type::Array ary(&i32, 5,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(4, Source{}),
|
create<ast::StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &ary, a_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -709,11 +709,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -766,12 +766,12 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
ast::type::I32 i32;
|
ast::type::I32 i32;
|
||||||
ast::type::Array ary(&i32, 5,
|
ast::type::Array ary(&i32, 5,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(4, Source{}),
|
create<ast::StrideDecoration>(Source{}, 4),
|
||||||
});
|
});
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &ary, a_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -830,11 +830,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -891,11 +891,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &ivec3, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec3, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -948,11 +948,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &ivec3, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &fvec3, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -1026,11 +1026,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &ivec3,
|
Source{}, "a", &ivec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &fvec3,
|
Source{}, "b", &fvec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::type::Array ary(&data, 4,
|
ast::type::Array ary(&data, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(32, Source{}),
|
create<ast::StrideDecoration>(Source{}, 32),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* pre_str = create<ast::Struct>(
|
auto* pre_str = create<ast::Struct>(
|
||||||
|
@ -1047,7 +1047,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "c", &ary,
|
Source{}, "c", &ary,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1117,11 +1117,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &ivec3,
|
Source{}, "a", &ivec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &fvec3,
|
Source{}, "b", &fvec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1129,14 +1129,14 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::type::Array ary(
|
ast::type::Array ary(
|
||||||
&data, 4,
|
&data, 4,
|
||||||
ast::ArrayDecorationList{create<ast::StrideDecoration>(32, Source{})});
|
ast::ArrayDecorationList{create<ast::StrideDecoration>(Source{}, 32)});
|
||||||
|
|
||||||
auto* pre_str = create<ast::Struct>(
|
auto* pre_str = create<ast::Struct>(
|
||||||
Source{},
|
Source{},
|
||||||
ast::StructMemberList{create<ast::StructMember>(
|
ast::StructMemberList{create<ast::StructMember>(
|
||||||
Source{}, "c", &ary,
|
Source{}, "c", &ary,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
||||||
|
@ -1207,11 +1207,11 @@ TEST_F(
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &ivec3,
|
Source{}, "a", &ivec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &fvec3,
|
Source{}, "b", &fvec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1219,7 +1219,7 @@ TEST_F(
|
||||||
|
|
||||||
ast::type::Array ary(&data, 4,
|
ast::type::Array ary(&data, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(32, Source{}),
|
create<ast::StrideDecoration>(Source{}, 32),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* pre_str = create<ast::Struct>(
|
auto* pre_str = create<ast::Struct>(
|
||||||
|
@ -1227,7 +1227,7 @@ TEST_F(
|
||||||
ast::StructMemberList{create<ast::StructMember>(
|
ast::StructMemberList{create<ast::StructMember>(
|
||||||
Source{}, "c", &ary,
|
Source{}, "c", &ary,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
||||||
|
@ -1297,11 +1297,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &ivec3,
|
Source{}, "a", &ivec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &fvec3,
|
Source{}, "b", &fvec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1309,7 +1309,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::type::Array ary(&data, 4,
|
ast::type::Array ary(&data, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(32, Source{}),
|
create<ast::StrideDecoration>(Source{}, 32),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* pre_str = create<ast::Struct>(
|
auto* pre_str = create<ast::Struct>(
|
||||||
|
@ -1317,7 +1317,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
ast::StructMemberList{create<ast::StructMember>(
|
ast::StructMemberList{create<ast::StructMember>(
|
||||||
Source{}, "c", &ary,
|
Source{}, "c", &ary,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
||||||
|
@ -1387,11 +1387,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &ivec3,
|
Source{}, "a", &ivec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &fvec3,
|
Source{}, "b", &fvec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1399,7 +1399,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::type::Array ary(&data, 4,
|
ast::type::Array ary(&data, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(32, Source{}),
|
create<ast::StrideDecoration>(Source{}, 32),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* pre_str = create<ast::Struct>(
|
auto* pre_str = create<ast::Struct>(
|
||||||
|
@ -1407,7 +1407,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
ast::StructMemberList{create<ast::StructMember>(
|
ast::StructMemberList{create<ast::StructMember>(
|
||||||
Source{}, "c", &ary,
|
Source{}, "c", &ary,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
||||||
|
@ -1487,11 +1487,11 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &ivec3,
|
Source{}, "a", &ivec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &fvec3,
|
Source{}, "b", &fvec3,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(16, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 16)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -1499,7 +1499,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
|
|
||||||
ast::type::Array ary(&data, 4,
|
ast::type::Array ary(&data, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(32, Source{}),
|
create<ast::StrideDecoration>(Source{}, 32),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* pre_str = create<ast::Struct>(
|
auto* pre_str = create<ast::Struct>(
|
||||||
|
@ -1507,7 +1507,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor,
|
||||||
ast::StructMemberList{create<ast::StructMember>(
|
ast::StructMemberList{create<ast::StructMember>(
|
||||||
Source{}, "c", &ary,
|
Source{}, "c", &ary,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(0, Source{})})},
|
create<ast::StructMemberOffsetDecoration>(Source{}, 0)})},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
ast::type::Struct pre_struct(mod.RegisterSymbol("Pre"), "Pre", pre_str);
|
||||||
|
|
|
@ -72,7 +72,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant) {
|
||||||
create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
|
create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(23, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 23),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error();
|
ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error();
|
||||||
|
@ -96,7 +96,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_SpecConstant_NoConstructor) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(23, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 23),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error();
|
ASSERT_TRUE(gen.EmitProgramConstVariable(out, var)) << gen.error();
|
||||||
|
|
|
@ -178,7 +178,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -203,7 +203,7 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Struct) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -220,15 +220,15 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_InjectPadding) {
|
||||||
ast::type::F32 f32;
|
ast::type::F32 f32;
|
||||||
|
|
||||||
ast::StructMemberDecorationList decos;
|
ast::StructMemberDecorationList decos;
|
||||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
|
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
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));
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -281,7 +281,7 @@ TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Struct_WithDecoration) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
ast::StructDecorationList decos;
|
ast::StructDecorationList decos;
|
||||||
|
|
|
@ -58,7 +58,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_Struct) {
|
||||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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", &i32, b_deco));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -83,7 +83,7 @@ TEST_F(MslGeneratorImplTest, EmitConstructedType_AliasStructIdent) {
|
||||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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", &i32, b_deco));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
|
|
@ -59,7 +59,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -71,7 +71,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -99,7 +99,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -136,7 +136,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -148,7 +148,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -176,7 +176,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("vtx_main"), "vtx_main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -213,7 +213,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -225,7 +225,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -253,7 +253,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -290,7 +290,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -302,7 +302,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -330,7 +330,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -364,7 +364,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -376,7 +376,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -404,7 +404,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -433,7 +433,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -445,7 +445,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -473,7 +473,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &f32, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -508,7 +508,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* depth_var = create<ast::Variable>(
|
auto* depth_var = create<ast::Variable>(
|
||||||
|
@ -520,7 +520,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -547,7 +547,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("main"), "main", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
|
@ -164,7 +164,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -176,7 +176,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -200,7 +200,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) {
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
||||||
ast::PipelineStage::kFragment, Source{})});
|
Source{}, ast::PipelineStage::kFragment)});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* depth_var = create<ast::Variable>(
|
auto* depth_var = create<ast::Variable>(
|
||||||
|
@ -253,7 +253,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -281,7 +281,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -318,8 +318,8 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -350,7 +350,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) {
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -376,11 +376,11 @@ TEST_F(MslGeneratorImplTest,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -400,8 +400,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -432,7 +432,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -462,11 +462,11 @@ TEST_F(MslGeneratorImplTest,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -486,8 +486,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -519,7 +519,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -557,7 +557,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* bar_var =
|
auto* bar_var =
|
||||||
|
@ -569,7 +569,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* val_var =
|
auto* val_var =
|
||||||
|
@ -581,7 +581,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(0, Source{}),
|
create<ast::LocationDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(foo_var);
|
td.RegisterVariableForTesting(foo_var);
|
||||||
|
@ -648,7 +648,7 @@ TEST_F(
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -697,7 +697,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(depth_var);
|
td.RegisterVariableForTesting(depth_var);
|
||||||
|
@ -749,7 +749,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -792,7 +792,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragCoord, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragCoord),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* depth_var = create<ast::Variable>(
|
auto* depth_var = create<ast::Variable>(
|
||||||
|
@ -804,7 +804,7 @@ TEST_F(
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kFragDepth),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -867,7 +867,7 @@ TEST_F(
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -909,8 +909,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -971,7 +971,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1000,11 +1000,11 @@ TEST_F(MslGeneratorImplTest,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -1024,8 +1024,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -1085,7 +1085,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1120,11 +1120,11 @@ TEST_F(MslGeneratorImplTest,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, a_deco));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -1144,8 +1144,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(coord_var);
|
td.RegisterVariableForTesting(coord_var);
|
||||||
|
@ -1205,7 +1205,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
Source{}, mod.RegisterSymbol("frag_main"), "frag_main", params,
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1247,7 +1247,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(1, Source{}),
|
create<ast::LocationDecoration>(Source{}, 1),
|
||||||
});
|
});
|
||||||
|
|
||||||
td.RegisterVariableForTesting(bar_var);
|
td.RegisterVariableForTesting(bar_var);
|
||||||
|
@ -1283,7 +1283,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* func_1 = create<ast::Function>(
|
auto* func_1 = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("ep_1"), "ep_1", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func_1);
|
mod.AddFunction(func_1);
|
||||||
|
@ -1316,7 +1316,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
Source{}, mod.RegisterSymbol("main"), "main", ast::VariableList{},
|
Source{}, mod.RegisterSymbol("main"), "main", ast::VariableList{},
|
||||||
&void_type, create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
&void_type, create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1392,7 +1392,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
|
||||||
|
|
||||||
ast::StructDecorationList s_decos;
|
ast::StructDecorationList s_decos;
|
||||||
|
@ -1412,8 +1412,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(0, Source{}),
|
create<ast::SetDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddConstructedType(&s);
|
mod.AddConstructedType(&s);
|
||||||
|
@ -1445,8 +1445,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -1476,8 +1476,8 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
|
@ -74,7 +74,7 @@ TEST_F(MslGeneratorImplTest, Emit_SpecConstant) {
|
||||||
create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
|
create<ast::FloatLiteral>(Source{}, &f32, 3.0f)), // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(23, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 23),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error();
|
ASSERT_TRUE(gen.EmitProgramConstVariable(var)) << gen.error();
|
||||||
|
|
|
@ -54,7 +54,7 @@ TEST_F(MslGeneratorImplTest, Generate) {
|
||||||
Source{}, mod.RegisterSymbol("my_func"), "my_func", ast::VariableList{},
|
Source{}, mod.RegisterSymbol("my_func"), "my_func", ast::VariableList{},
|
||||||
&void_type, create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
&void_type, create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
||||||
|
@ -160,15 +160,15 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct) {
|
||||||
ast::type::F32 f32;
|
ast::type::F32 f32;
|
||||||
|
|
||||||
ast::StructMemberDecorationList decos;
|
ast::StructMemberDecorationList decos;
|
||||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(4, Source{}));
|
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 4));
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
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));
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -185,15 +185,15 @@ TEST_F(MslGeneratorImplTest, calculate_alignment_size_struct_of_struct) {
|
||||||
ast::type::Vector fvec(&f32, 3);
|
ast::type::Vector fvec(&f32, 3);
|
||||||
|
|
||||||
ast::StructMemberDecorationList decos;
|
ast::StructMemberDecorationList decos;
|
||||||
decos.push_back(create<ast::StructMemberOffsetDecoration>(0, Source{}));
|
decos.push_back(create<ast::StructMemberOffsetDecoration>(Source{}, 0));
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
members.push_back(create<ast::StructMember>(Source{}, "a", &i32, decos));
|
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));
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "c", &f32, decos));
|
||||||
|
|
||||||
auto* inner_str =
|
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);
|
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));
|
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));
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "f", &f32, decos));
|
||||||
|
|
||||||
auto* outer_str =
|
auto* outer_str =
|
||||||
|
|
|
@ -179,7 +179,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -200,7 +200,7 @@ TEST_F(MslGeneratorImplTest, EmitType_StructDecl) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -226,15 +226,15 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_InjectPadding) {
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "a", &i32,
|
Source{}, "a", &i32,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(4, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 4)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "b", &f32,
|
Source{}, "b", &f32,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(32, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 32)}),
|
||||||
create<ast::StructMember>(
|
create<ast::StructMember>(
|
||||||
Source{}, "c", &f32,
|
Source{}, "c", &f32,
|
||||||
ast::StructMemberDecorationList{
|
ast::StructMemberDecorationList{
|
||||||
create<ast::StructMemberOffsetDecoration>(128, Source{})}),
|
create<ast::StructMemberOffsetDecoration>(Source{}, 128)}),
|
||||||
},
|
},
|
||||||
ast::StructDecorationList{});
|
ast::StructDecorationList{});
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
ast::StructDecorationList decos;
|
ast::StructDecorationList decos;
|
||||||
|
|
|
@ -107,7 +107,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Struct) {
|
||||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
|
|
@ -45,7 +45,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage) {
|
||||||
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(b.GenerateFunction(&func)) << b.error();
|
ASSERT_TRUE(b.GenerateFunction(&func)) << b.error();
|
||||||
|
@ -72,7 +72,7 @@ TEST_P(FunctionDecoration_StageTest, Emit) {
|
||||||
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(params.stage, Source{}),
|
create<ast::StageDecoration>(Source{}, params.stage),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(b.GenerateFunction(&func)) << b.error();
|
ASSERT_TRUE(b.GenerateFunction(&func)) << b.error();
|
||||||
|
@ -102,7 +102,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUnusedInterfaceIds) {
|
||||||
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* v_in =
|
auto* v_in =
|
||||||
|
@ -191,7 +191,7 @@ TEST_F(BuilderTest, FunctionDecoration_Stage_WithUsedInterfaceIds) {
|
||||||
ast::Function func(
|
ast::Function func(
|
||||||
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, body,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* v_in =
|
auto* v_in =
|
||||||
|
@ -262,7 +262,7 @@ TEST_F(BuilderTest, FunctionDecoration_ExecutionMode_Fragment_OriginUpperLeft) {
|
||||||
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error();
|
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,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error();
|
ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error();
|
||||||
|
@ -294,8 +294,8 @@ TEST_F(BuilderTest, FunctionDecoration_WorkgroupSize) {
|
||||||
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
Source{}, mod->RegisterSymbol("main"), "main", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
|
create<ast::WorkgroupDecoration>(Source{}, 2u, 4u, 6u),
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(b.GenerateExecutionModes(&func, 3)) << b.error();
|
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,
|
Source{}, mod->RegisterSymbol("main1"), "main1", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
ast::Function func2(
|
ast::Function func2(
|
||||||
Source{}, mod->RegisterSymbol("main2"), "main2", {}, &void_type,
|
Source{}, mod->RegisterSymbol("main2"), "main2", {}, &void_type,
|
||||||
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
create<ast::BlockStatement>(Source{}, ast::StatementList{}),
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(b.GenerateFunction(&func1)) << b.error();
|
ASSERT_TRUE(b.GenerateFunction(&func1)) << b.error();
|
||||||
|
|
|
@ -274,7 +274,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
|
||||||
|
|
||||||
ast::StructDecorationList s_decos;
|
ast::StructDecorationList s_decos;
|
||||||
|
@ -294,8 +294,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(0, Source{}),
|
create<ast::SetDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->AddConstructedType(&s);
|
mod->AddConstructedType(&s);
|
||||||
|
@ -328,8 +328,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod->RegisterSymbol("a"), "a", params, &void_type, body,
|
Source{}, mod->RegisterSymbol("a"), "a", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->AddFunction(func);
|
mod->AddFunction(func);
|
||||||
|
@ -360,8 +360,8 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod->RegisterSymbol("b"), "b", params, &void_type, body,
|
Source{}, mod->RegisterSymbol("b"), "b", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->AddFunction(func);
|
mod->AddFunction(func);
|
||||||
|
|
|
@ -251,7 +251,7 @@ TEST_F(BuilderTest, GlobalVar_WithLocation) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::LocationDecoration>(5, Source{}),
|
create<ast::LocationDecoration>(Source{}, 5),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
@ -277,8 +277,8 @@ TEST_F(BuilderTest, GlobalVar_WithBindingAndSet) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(2, Source{}),
|
create<ast::BindingDecoration>(Source{}, 2),
|
||||||
create<ast::SetDecoration>(3, Source{}),
|
create<ast::SetDecoration>(Source{}, 3),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
@ -305,7 +305,7 @@ TEST_F(BuilderTest, GlobalVar_WithBuiltin) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
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
|
create<ast::BoolLiteral>(Source{}, &bool_type, true)), // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(1200, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 1200),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
@ -361,7 +361,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Bool_NoConstructor) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(1200, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 1200),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
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
|
create<ast::FloatLiteral>(Source{}, &f32, 2.0)), // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(0, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
@ -417,7 +417,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_F32_NoConstructor) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(0, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
@ -444,7 +444,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_I32_NoConstructor) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(0, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
@ -471,7 +471,7 @@ TEST_F(BuilderTest, GlobalVar_ConstantId_Scalar_U32_NoConstructor) {
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::ConstantIdDecoration>(0, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
EXPECT_TRUE(b.GenerateGlobalVariable(v)) << b.error();
|
||||||
|
|
|
@ -125,7 +125,7 @@ TEST_F(BuilderTest_Type, GenerateArray_WithStride) {
|
||||||
|
|
||||||
ast::type::Array ary(&i32, 4,
|
ast::type::Array ary(&i32, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(16u, Source{}),
|
create<ast::StrideDecoration>(Source{}, 16u),
|
||||||
});
|
});
|
||||||
|
|
||||||
auto id = b.GenerateTypeIfNeeded(&ary);
|
auto id = b.GenerateTypeIfNeeded(&ary);
|
||||||
|
@ -346,9 +346,9 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) {
|
||||||
ast::type::F32 f32;
|
ast::type::F32 f32;
|
||||||
|
|
||||||
ast::StructMemberDecorationList a_decos;
|
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;
|
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;
|
ast::StructMemberList members;
|
||||||
members.push_back(create<ast::StructMember>(Source{}, "a", &f32, a_decos));
|
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::type::Matrix glsl_mat4x4(&f32, 4, 4);
|
||||||
|
|
||||||
ast::StructMemberDecorationList a_decos;
|
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;
|
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;
|
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;
|
ast::StructMemberList members;
|
||||||
members.push_back(
|
members.push_back(
|
||||||
|
@ -490,11 +490,11 @@ TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_LayoutArraysOfMatrix) {
|
||||||
ast::ArrayDecorationList{}); // Runtime array
|
ast::ArrayDecorationList{}); // Runtime array
|
||||||
|
|
||||||
ast::StructMemberDecorationList a_decos;
|
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;
|
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;
|
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;
|
ast::StructMemberList members;
|
||||||
members.push_back(
|
members.push_back(
|
||||||
|
|
|
@ -48,7 +48,7 @@ TEST_F(WgslGeneratorImplTest, EmitConstructedType_Struct) {
|
||||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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", &i32, b_deco));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -77,7 +77,7 @@ TEST_F(WgslGeneratorImplTest, EmitAlias_ToStruct) {
|
||||||
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &f32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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", &i32, b_deco));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &i32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
|
|
@ -110,7 +110,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_WorkgroupSize) {
|
||||||
ast::Function func(Source{}, mod.RegisterSymbol("my_func"), "my_func", {},
|
ast::Function func(Source{}, mod.RegisterSymbol("my_func"), "my_func", {},
|
||||||
&void_type, body,
|
&void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
|
create<ast::WorkgroupDecoration>(Source{}, 2u, 4u, 6u),
|
||||||
});
|
});
|
||||||
|
|
||||||
gen.increment_indent();
|
gen.increment_indent();
|
||||||
|
@ -134,7 +134,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Stage) {
|
||||||
ast::Function func(
|
ast::Function func(
|
||||||
Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body,
|
Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
gen.increment_indent();
|
gen.increment_indent();
|
||||||
|
@ -158,8 +158,8 @@ TEST_F(WgslGeneratorImplTest, Emit_Function_WithDecoration_Multiple) {
|
||||||
ast::Function func(
|
ast::Function func(
|
||||||
Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body,
|
Source{}, mod.RegisterSymbol("my_func"), "my_func", {}, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
|
create<ast::StageDecoration>(Source{}, ast::PipelineStage::kFragment),
|
||||||
create<ast::WorkgroupDecoration>(2u, 4u, 6u, Source{}),
|
create<ast::WorkgroupDecoration>(Source{}, 2u, 4u, 6u),
|
||||||
});
|
});
|
||||||
|
|
||||||
gen.increment_indent();
|
gen.increment_indent();
|
||||||
|
@ -197,7 +197,7 @@ TEST_F(WgslGeneratorImplTest,
|
||||||
|
|
||||||
ast::StructMemberList members;
|
ast::StructMemberList members;
|
||||||
ast::StructMemberDecorationList a_deco;
|
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));
|
members.push_back(create<ast::StructMember>(Source{}, "d", &f32, a_deco));
|
||||||
|
|
||||||
ast::StructDecorationList s_decos;
|
ast::StructDecorationList s_decos;
|
||||||
|
@ -217,8 +217,8 @@ TEST_F(WgslGeneratorImplTest,
|
||||||
nullptr, // constructor
|
nullptr, // constructor
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
// decorations
|
// decorations
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(0, Source{}),
|
create<ast::SetDecoration>(Source{}, 0),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddConstructedType(&s);
|
mod.AddConstructedType(&s);
|
||||||
|
@ -250,8 +250,8 @@ TEST_F(WgslGeneratorImplTest,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("a"), "a", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
@ -281,8 +281,8 @@ TEST_F(WgslGeneratorImplTest,
|
||||||
auto* func = create<ast::Function>(
|
auto* func = create<ast::Function>(
|
||||||
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
|
Source{}, mod.RegisterSymbol("b"), "b", params, &void_type, body,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute,
|
create<ast::StageDecoration>(Source{},
|
||||||
Source{}),
|
ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.AddFunction(func);
|
mod.AddFunction(func);
|
||||||
|
|
|
@ -107,7 +107,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_Decoration) {
|
||||||
ast::type::Bool b;
|
ast::type::Bool b;
|
||||||
ast::type::Array a(&b, 4,
|
ast::type::Array a(&b, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(16u, Source{}),
|
create<ast::StrideDecoration>(Source{}, 16u),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitType(&a)) << gen.error();
|
ASSERT_TRUE(gen.EmitType(&a)) << gen.error();
|
||||||
|
@ -118,8 +118,8 @@ TEST_F(WgslGeneratorImplTest, EmitType_Array_MultipleDecorations) {
|
||||||
ast::type::Bool b;
|
ast::type::Bool b;
|
||||||
ast::type::Array a(&b, 4,
|
ast::type::Array a(&b, 4,
|
||||||
ast::ArrayDecorationList{
|
ast::ArrayDecorationList{
|
||||||
create<ast::StrideDecoration>(16u, Source{}),
|
create<ast::StrideDecoration>(Source{}, 16u),
|
||||||
create<ast::StrideDecoration>(32u, Source{}),
|
create<ast::StrideDecoration>(Source{}, 32u),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitType(&a)) << gen.error();
|
ASSERT_TRUE(gen.EmitType(&a)) << gen.error();
|
||||||
|
@ -180,7 +180,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -201,7 +201,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_StructDecl) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
auto* str =
|
auto* str =
|
||||||
|
@ -227,7 +227,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Struct_WithDecoration) {
|
||||||
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
Source{}, "a", &i32, ast::StructMemberDecorationList{}));
|
||||||
|
|
||||||
ast::StructMemberDecorationList b_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));
|
members.push_back(create<ast::StructMember>(Source{}, "b", &f32, b_deco));
|
||||||
|
|
||||||
ast::StructDecorationList decos;
|
ast::StructDecorationList decos;
|
||||||
|
|
|
@ -58,7 +58,7 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated) {
|
||||||
|
|
||||||
ast::Variable v(Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr,
|
ast::Variable v(Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<ast::LocationDecoration>(2, Source{}),
|
create<ast::LocationDecoration>(Source{}, 2),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();
|
ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();
|
||||||
|
@ -72,11 +72,11 @@ TEST_F(WgslGeneratorImplTest, EmitVariable_Decorated_Multiple) {
|
||||||
ast::Variable v(
|
ast::Variable v(
|
||||||
Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr,
|
Source{}, "a", ast::StorageClass::kNone, &f32, false, nullptr,
|
||||||
ast::VariableDecorationList{
|
ast::VariableDecorationList{
|
||||||
create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{}),
|
create<ast::BuiltinDecoration>(Source{}, ast::Builtin::kPosition),
|
||||||
create<ast::BindingDecoration>(0, Source{}),
|
create<ast::BindingDecoration>(Source{}, 0),
|
||||||
create<ast::SetDecoration>(1, Source{}),
|
create<ast::SetDecoration>(Source{}, 1),
|
||||||
create<ast::LocationDecoration>(2, Source{}),
|
create<ast::LocationDecoration>(Source{}, 2),
|
||||||
create<ast::ConstantIdDecoration>(42, Source{}),
|
create<ast::ConstantIdDecoration>(Source{}, 42),
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();
|
ASSERT_TRUE(gen.EmitVariable(&v)) << gen.error();
|
||||||
|
|
Loading…
Reference in New Issue