Program: Remove deprecated function methods
Fixup all usages Bug: tint:390 Change-Id: I949235908e50702d6c8b2e7e2299594879653e01 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38547 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
1b3d6e460c
commit
83158f214f
|
@ -50,7 +50,7 @@ Inspector::~Inspector() = default;
|
||||||
std::vector<EntryPoint> Inspector::GetEntryPoints() {
|
std::vector<EntryPoint> Inspector::GetEntryPoints() {
|
||||||
std::vector<EntryPoint> result;
|
std::vector<EntryPoint> result;
|
||||||
|
|
||||||
for (auto* func : program_.Functions()) {
|
for (auto* func : program_.AST().Functions()) {
|
||||||
if (!func->IsEntryPoint()) {
|
if (!func->IsEntryPoint()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ std::vector<ResourceBinding> Inspector::GetMultisampledTextureResourceBindings(
|
||||||
}
|
}
|
||||||
|
|
||||||
ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
|
ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
|
||||||
auto* func = program_.Functions().Find(program_.GetSymbol(name));
|
auto* func = program_.AST().Functions().Find(program_.GetSymbol(name));
|
||||||
if (!func) {
|
if (!func) {
|
||||||
error_ += name + " was not found!";
|
error_ += name + " was not found!";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -701,7 +701,7 @@ TEST_F(InspectorGetEntryPointTest, NoFunctions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InspectorGetEntryPointTest, NoEntryPoints) {
|
TEST_F(InspectorGetEntryPointTest, NoEntryPoints) {
|
||||||
mod->Functions().Add(MakeEmptyBodyFunction("foo", {}));
|
mod->AST().Functions().Add(MakeEmptyBodyFunction("foo", {}));
|
||||||
|
|
||||||
auto result = inspector()->GetEntryPoints();
|
auto result = inspector()->GetEntryPoints();
|
||||||
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
||||||
|
@ -714,7 +714,7 @@ TEST_F(InspectorGetEntryPointTest, OneEntryPoint) {
|
||||||
"foo", ast::FunctionDecorationList{
|
"foo", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
// TODO(dsinclair): Update to run the namer transform when available.
|
// TODO(dsinclair): Update to run the namer transform when available.
|
||||||
|
|
||||||
|
@ -732,13 +732,13 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
|
||||||
"foo", ast::FunctionDecorationList{
|
"foo", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto* bar = MakeEmptyBodyFunction(
|
auto* bar = MakeEmptyBodyFunction(
|
||||||
"bar", ast::FunctionDecorationList{
|
"bar", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(bar);
|
mod->AST().Functions().Add(bar);
|
||||||
|
|
||||||
// TODO(dsinclair): Update to run the namer transform when available.
|
// TODO(dsinclair): Update to run the namer transform when available.
|
||||||
|
|
||||||
|
@ -756,21 +756,21 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPoints) {
|
||||||
|
|
||||||
TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
|
TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
|
||||||
auto* func = MakeEmptyBodyFunction("func", {});
|
auto* func = MakeEmptyBodyFunction("func", {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto* bar = MakeCallerBodyFunction(
|
auto* bar = MakeCallerBodyFunction(
|
||||||
"bar", "func",
|
"bar", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(bar);
|
mod->AST().Functions().Add(bar);
|
||||||
|
|
||||||
// TODO(dsinclair): Update to run the namer transform when available.
|
// TODO(dsinclair): Update to run the namer transform when available.
|
||||||
|
|
||||||
|
@ -792,7 +792,7 @@ TEST_F(InspectorGetEntryPointTest, DefaultWorkgroupSize) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto result = inspector()->GetEntryPoints();
|
auto result = inspector()->GetEntryPoints();
|
||||||
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
||||||
|
@ -811,7 +811,7 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
create<ast::WorkgroupDecoration>(8u, 2u, 1u),
|
create<ast::WorkgroupDecoration>(8u, 2u, 1u),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto result = inspector()->GetEntryPoints();
|
auto result = inspector()->GetEntryPoints();
|
||||||
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
||||||
|
@ -826,14 +826,14 @@ TEST_F(InspectorGetEntryPointTest, NonDefaultWorkgroupSize) {
|
||||||
|
|
||||||
TEST_F(InspectorGetEntryPointTest, NoInOutVariables) {
|
TEST_F(InspectorGetEntryPointTest, NoInOutVariables) {
|
||||||
auto* func = MakeEmptyBodyFunction("func", {});
|
auto* func = MakeEmptyBodyFunction("func", {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto result = inspector()->GetEntryPoints();
|
auto result = inspector()->GetEntryPoints();
|
||||||
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
||||||
|
@ -851,7 +851,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointInOutVariables) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -875,14 +875,14 @@ TEST_F(InspectorGetEntryPointTest, FunctionInOutVariables) {
|
||||||
|
|
||||||
auto* func =
|
auto* func =
|
||||||
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -906,14 +906,14 @@ TEST_F(InspectorGetEntryPointTest, RepeatedInOutVariables) {
|
||||||
|
|
||||||
auto* func =
|
auto* func =
|
||||||
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ TEST_F(InspectorGetEntryPointTest, EntryPointMultipleInOutVariables) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -970,14 +970,14 @@ TEST_F(InspectorGetEntryPointTest, FunctionMultipleInOutVariables) {
|
||||||
|
|
||||||
auto* func = MakeInOutVariableBodyFunction(
|
auto* func = MakeInOutVariableBodyFunction(
|
||||||
"func", {{"in_var", "out_var"}, {"in2_var", "out2_var"}}, {});
|
"func", {{"in_var", "out_var"}, {"in2_var", "out2_var"}}, {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1011,14 +1011,14 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutVariables) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(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),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(bar);
|
mod->AST().Functions().Add(bar);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1057,21 +1057,21 @@ TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsSharedInOutVariables) {
|
||||||
|
|
||||||
auto* func =
|
auto* func =
|
||||||
MakeInOutVariableBodyFunction("func", {{"in2_var", "out2_var"}}, {});
|
MakeInOutVariableBodyFunction("func", {{"in2_var", "out2_var"}}, {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto* bar = MakeCallerBodyFunction(
|
auto* bar = MakeCallerBodyFunction(
|
||||||
"bar", "func",
|
"bar", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(bar);
|
mod->AST().Functions().Add(bar);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1123,14 +1123,14 @@ TEST_F(InspectorGetEntryPointTest, BuiltInsNotStageVariables) {
|
||||||
ast::VariableDecorationList{create<ast::LocationDecoration>(0)}));
|
ast::VariableDecorationList{create<ast::LocationDecoration>(0)}));
|
||||||
auto* func =
|
auto* func =
|
||||||
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* foo = MakeCallerBodyFunction(
|
auto* foo = MakeCallerBodyFunction(
|
||||||
"foo", "func",
|
"foo", "func",
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1162,7 +1162,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_NoFunctions) {
|
||||||
// TODO(rharrison): Reenable once GetRemappedNameForEntryPoint isn't a pass
|
// TODO(rharrison): Reenable once GetRemappedNameForEntryPoint isn't a pass
|
||||||
// through
|
// through
|
||||||
TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_NoEntryPoints) {
|
TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_NoEntryPoints) {
|
||||||
mod->Functions().Add(MakeEmptyBodyFunction("foo", {}));
|
mod->AST().Functions().Add(MakeEmptyBodyFunction("foo", {}));
|
||||||
|
|
||||||
auto result = inspector()->GetRemappedNameForEntryPoint("foo");
|
auto result = inspector()->GetRemappedNameForEntryPoint("foo");
|
||||||
ASSERT_TRUE(inspector()->has_error());
|
ASSERT_TRUE(inspector()->has_error());
|
||||||
|
@ -1177,7 +1177,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_OneEntryPoint) {
|
||||||
"foo", ast::FunctionDecorationList{
|
"foo", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
// TODO(dsinclair): Update to run the namer transform when available.
|
// TODO(dsinclair): Update to run the namer transform when available.
|
||||||
|
|
||||||
|
@ -1195,7 +1195,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest,
|
||||||
"foo", ast::FunctionDecorationList{
|
"foo", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
// TODO(dsinclair): Update to run the namer transform when available.
|
// TODO(dsinclair): Update to run the namer transform when available.
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ TEST_F(InspectorGetRemappedNameForEntryPointTest,
|
||||||
"bar", ast::FunctionDecorationList{
|
"bar", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(bar);
|
mod->AST().Functions().Add(bar);
|
||||||
|
|
||||||
{
|
{
|
||||||
auto result = inspector()->GetRemappedNameForEntryPoint("foo");
|
auto result = inspector()->GetRemappedNameForEntryPoint("foo");
|
||||||
|
@ -1321,14 +1321,14 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) {
|
||||||
|
|
||||||
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(ub_func);
|
mod->AST().Functions().Add(ub_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1349,14 +1349,14 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MissingBlockDeco) {
|
||||||
|
|
||||||
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(ub_func);
|
mod->AST().Functions().Add(ub_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1374,14 +1374,14 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple) {
|
||||||
|
|
||||||
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(ub_func);
|
mod->AST().Functions().Add(ub_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1403,14 +1403,14 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) {
|
||||||
|
|
||||||
auto* ub_func = MakeStructVariableReferenceBodyFunction(
|
auto* ub_func = MakeStructVariableReferenceBodyFunction(
|
||||||
"ub_func", "foo_ub", {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
"ub_func", "foo_ub", {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
||||||
mod->Functions().Add(ub_func);
|
mod->AST().Functions().Add(ub_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1436,7 +1436,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) {
|
||||||
const std::string& var_name) {
|
const std::string& var_name) {
|
||||||
auto* ub_func = MakeStructVariableReferenceBodyFunction(
|
auto* ub_func = MakeStructVariableReferenceBodyFunction(
|
||||||
func_name, var_name, {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
func_name, var_name, {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
||||||
mod->Functions().Add(ub_func);
|
mod->AST().Functions().Add(ub_func);
|
||||||
};
|
};
|
||||||
AddReferenceFunc("ub_foo_func", "ub_foo");
|
AddReferenceFunc("ub_foo_func", "ub_foo");
|
||||||
AddReferenceFunc("ub_bar_func", "ub_bar");
|
AddReferenceFunc("ub_bar_func", "ub_bar");
|
||||||
|
@ -1454,7 +1454,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1484,14 +1484,14 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingArray) {
|
||||||
|
|
||||||
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(ub_func);
|
mod->AST().Functions().Add(ub_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1513,14 +1513,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, Simple) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1542,14 +1542,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleMembers) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction(
|
auto* sb_func = MakeStructVariableReferenceBodyFunction(
|
||||||
"sb_func", "foo_sb", {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
"sb_func", "foo_sb", {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1575,7 +1575,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) {
|
||||||
const std::string& var_name) {
|
const std::string& var_name) {
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction(
|
auto* sb_func = MakeStructVariableReferenceBodyFunction(
|
||||||
func_name, var_name, {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
func_name, var_name, {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
};
|
};
|
||||||
AddReferenceFunc("sb_foo_func", "sb_foo");
|
AddReferenceFunc("sb_foo_func", "sb_foo");
|
||||||
AddReferenceFunc("sb_bar_func", "sb_bar");
|
AddReferenceFunc("sb_bar_func", "sb_bar");
|
||||||
|
@ -1596,7 +1596,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1626,14 +1626,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingArray) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1655,14 +1655,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, ContainingRuntimeArray) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1684,14 +1684,14 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, SkipReadOnly) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1709,14 +1709,14 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, Simple) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1744,7 +1744,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest,
|
||||||
const std::string& var_name) {
|
const std::string& var_name) {
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction(
|
auto* sb_func = MakeStructVariableReferenceBodyFunction(
|
||||||
func_name, var_name, {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
func_name, var_name, {{0, ty.i32}, {1, ty.u32}, {2, ty.f32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
};
|
};
|
||||||
AddReferenceFunc("sb_foo_func", "sb_foo");
|
AddReferenceFunc("sb_foo_func", "sb_foo");
|
||||||
AddReferenceFunc("sb_bar_func", "sb_bar");
|
AddReferenceFunc("sb_bar_func", "sb_bar");
|
||||||
|
@ -1765,7 +1765,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1796,14 +1796,14 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, ContainingArray) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1827,14 +1827,14 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest,
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1857,14 +1857,14 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, SkipNonReadOnly) {
|
||||||
|
|
||||||
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
|
||||||
{{0, ty.i32}});
|
{{0, ty.i32}});
|
||||||
mod->Functions().Add(sb_func);
|
mod->AST().Functions().Add(sb_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1886,7 +1886,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, Simple) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1903,7 +1903,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, NoSampler) {
|
||||||
"ep_func", ast::FunctionDecorationList{
|
"ep_func", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1922,14 +1922,14 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, InFunction) {
|
||||||
|
|
||||||
auto* foo_func = MakeSamplerReferenceBodyFunction(
|
auto* foo_func = MakeSamplerReferenceBodyFunction(
|
||||||
"foo_func", "foo_texture", "foo_sampler", "foo_coords", ty.f32, {});
|
"foo_func", "foo_texture", "foo_sampler", "foo_coords", ty.f32, {});
|
||||||
mod->Functions().Add(foo_func);
|
mod->AST().Functions().Add(foo_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1953,7 +1953,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1973,7 +1973,7 @@ TEST_F(InspectorGetSamplerResourceBindingsTest, SkipsComparisonSamplers) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -1995,7 +1995,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, Simple) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2012,7 +2012,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, NoSampler) {
|
||||||
"ep_func", ast::FunctionDecorationList{
|
"ep_func", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2032,14 +2032,14 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, InFunction) {
|
||||||
auto* foo_func = MakeComparisonSamplerReferenceBodyFunction(
|
auto* foo_func = MakeComparisonSamplerReferenceBodyFunction(
|
||||||
"foo_func", "foo_texture", "foo_sampler", "foo_coords", "foo_depth",
|
"foo_func", "foo_texture", "foo_sampler", "foo_coords", "foo_depth",
|
||||||
ty.f32, {});
|
ty.f32, {});
|
||||||
mod->Functions().Add(foo_func);
|
mod->AST().Functions().Add(foo_func);
|
||||||
|
|
||||||
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),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(ep_func);
|
mod->AST().Functions().Add(ep_func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2063,7 +2063,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, UnknownEntryPoint) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2083,7 +2083,7 @@ TEST_F(InspectorGetComparisonSamplerResourceBindingsTest, SkipsSamplers) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2098,7 +2098,7 @@ TEST_F(InspectorGetSampledTextureResourceBindingsTest, Empty) {
|
||||||
"foo", ast::FunctionDecorationList{
|
"foo", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto result = inspector()->GetSampledTextureResourceBindings("foo");
|
auto result = inspector()->GetSampledTextureResourceBindings("foo");
|
||||||
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
||||||
|
@ -2121,7 +2121,7 @@ TEST_P(InspectorGetSampledTextureResourceBindingsTestWithParam, textureSample) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2212,7 +2212,7 @@ TEST_P(InspectorGetSampledArrayTextureResourceBindingsTestWithParam,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2283,7 +2283,7 @@ TEST_P(InspectorGetMultisampledTextureResourceBindingsTestWithParam,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -2338,7 +2338,7 @@ TEST_F(InspectorGetMultisampledArrayTextureResourceBindingsTest, Empty) {
|
||||||
"foo", ast::FunctionDecorationList{
|
"foo", ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(foo);
|
mod->AST().Functions().Add(foo);
|
||||||
|
|
||||||
auto result = inspector()->GetSampledTextureResourceBindings("foo");
|
auto result = inspector()->GetSampledTextureResourceBindings("foo");
|
||||||
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
|
||||||
|
@ -2363,7 +2363,7 @@ TEST_P(InspectorGetMultisampledArrayTextureResourceBindingsTestWithParam,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td()->Determine()) << td()->error();
|
ASSERT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
|
|
@ -118,14 +118,6 @@ class Program {
|
||||||
return types_.Get<T>(std::forward<ARGS>(args)...);
|
return types_.Get<T>(std::forward<ARGS>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @returns the functions declared in the translation unit
|
|
||||||
/// [DEPRECATED]: Use AST().Functions()
|
|
||||||
const ast::FunctionList& Functions() const { return AST().Functions(); }
|
|
||||||
|
|
||||||
/// @returns the functions declared in the translation unit
|
|
||||||
/// [DEPRECATED]: Use AST().Functions()
|
|
||||||
ast::FunctionList& Functions() { return AST().Functions(); }
|
|
||||||
|
|
||||||
/// Returns all the declared types in the program
|
/// Returns all the declared types in the program
|
||||||
/// [DEPRECATED]: Use AST().Types().types()
|
/// [DEPRECATED]: Use AST().Types().types()
|
||||||
/// @returns the mapping from name string to type.
|
/// @returns the mapping from name string to type.
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace {
|
||||||
using ProgramTest = ast::TestHelper;
|
using ProgramTest = ast::TestHelper;
|
||||||
|
|
||||||
TEST_F(ProgramTest, Creation) {
|
TEST_F(ProgramTest, Creation) {
|
||||||
EXPECT_EQ(mod->Functions().size(), 0u);
|
EXPECT_EQ(mod->AST().Functions().size(), 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProgramTest, ToStrEmitsPreambleAndPostamble) {
|
TEST_F(ProgramTest, ToStrEmitsPreambleAndPostamble) {
|
||||||
|
@ -90,12 +90,12 @@ TEST_F(ProgramTest, IsValid_Function) {
|
||||||
auto* func = Func("main", ast::VariableList(), ty.f32, ast::StatementList{},
|
auto* func = Func("main", ast::VariableList(), ty.f32, ast::StatementList{},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
EXPECT_TRUE(mod->IsValid());
|
EXPECT_TRUE(mod->IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProgramTest, IsValid_Null_Function) {
|
TEST_F(ProgramTest, IsValid_Null_Function) {
|
||||||
mod->Functions().Add(nullptr);
|
mod->AST().Functions().Add(nullptr);
|
||||||
EXPECT_FALSE(mod->IsValid());
|
EXPECT_FALSE(mod->IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ TEST_F(ProgramTest, IsValid_Invalid_Function) {
|
||||||
auto* func = Func("main", ast::VariableList{}, nullptr, ast::StatementList{},
|
auto* func = Func("main", ast::VariableList{}, nullptr, ast::StatementList{},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
EXPECT_FALSE(mod->IsValid());
|
EXPECT_FALSE(mod->IsValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -859,7 +859,7 @@ bool FunctionEmitter::Emit() {
|
||||||
|
|
||||||
auto& statements = statements_stack_[0].GetStatements();
|
auto& statements = statements_stack_[0].GetStatements();
|
||||||
auto* body = create<ast::BlockStatement>(Source{}, statements);
|
auto* body = create<ast::BlockStatement>(Source{}, statements);
|
||||||
program_.Functions().Add(create<ast::Function>(
|
program_.AST().Functions().Add(create<ast::Function>(
|
||||||
decl.source, program_.RegisterSymbol(decl.name), std::move(decl.params),
|
decl.source, program_.RegisterSymbol(decl.name), std::move(decl.params),
|
||||||
decl.return_type, body, std::move(decl.decorations)));
|
decl.return_type, body, std::move(decl.decorations)));
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ Expect<bool> ParserImpl::expect_global_decl() {
|
||||||
if (func.errored)
|
if (func.errored)
|
||||||
errored = true;
|
errored = true;
|
||||||
if (func.matched) {
|
if (func.matched) {
|
||||||
program_.Functions().Add(func.value);
|
program_.AST().Functions().Add(func.value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,8 @@ TEST_F(ParserImplTest, GlobalDecl_Function) {
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
|
|
||||||
auto& m = p->get_program();
|
auto& m = p->get_program();
|
||||||
ASSERT_EQ(m.Functions().size(), 1u);
|
ASSERT_EQ(m.AST().Functions().size(), 1u);
|
||||||
EXPECT_EQ(m.SymbolToName(m.Functions()[0]->symbol()), "main");
|
EXPECT_EQ(m.SymbolToName(m.AST().Functions()[0]->symbol()), "main");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, GlobalDecl_Function_WithDecoration) {
|
TEST_F(ParserImplTest, GlobalDecl_Function_WithDecoration) {
|
||||||
|
@ -145,8 +145,8 @@ TEST_F(ParserImplTest, GlobalDecl_Function_WithDecoration) {
|
||||||
ASSERT_FALSE(p->has_error()) << p->error();
|
ASSERT_FALSE(p->has_error()) << p->error();
|
||||||
|
|
||||||
auto& m = p->get_program();
|
auto& m = p->get_program();
|
||||||
ASSERT_EQ(m.Functions().size(), 1u);
|
ASSERT_EQ(m.AST().Functions().size(), 1u);
|
||||||
EXPECT_EQ(m.SymbolToName(m.Functions()[0]->symbol()), "main");
|
EXPECT_EQ(m.SymbolToName(m.AST().Functions()[0]->symbol()), "main");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) {
|
TEST_F(ParserImplTest, GlobalDecl_Function_Invalid) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn main() -> void {
|
||||||
ASSERT_TRUE(p->Parse()) << p->error();
|
ASSERT_TRUE(p->Parse()) << p->error();
|
||||||
|
|
||||||
auto& m = p->get_program();
|
auto& m = p->get_program();
|
||||||
ASSERT_EQ(1u, m.Functions().size());
|
ASSERT_EQ(1u, m.AST().Functions().size());
|
||||||
ASSERT_EQ(1u, m.AST().GlobalVariables().size());
|
ASSERT_EQ(1u, m.AST().GlobalVariables().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ fn main() -> void {
|
||||||
ASSERT_TRUE(p.Parse()) << p.error();
|
ASSERT_TRUE(p.Parse()) << p.error();
|
||||||
|
|
||||||
auto m = p.program();
|
auto m = p.program();
|
||||||
ASSERT_EQ(1u, m.Functions().size());
|
ASSERT_EQ(1u, m.AST().Functions().size());
|
||||||
ASSERT_EQ(1u, m.AST().GlobalVariables().size());
|
ASSERT_EQ(1u, m.AST().GlobalVariables().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ EmitVertexPointSize::~EmitVertexPointSize() = default;
|
||||||
Transform::Output EmitVertexPointSize::Run(const Program* in) {
|
Transform::Output EmitVertexPointSize::Run(const Program* in) {
|
||||||
Output out;
|
Output out;
|
||||||
|
|
||||||
if (!in->Functions().HasStage(ast::PipelineStage::kVertex)) {
|
if (!in->AST().Functions().HasStage(ast::PipelineStage::kVertex)) {
|
||||||
// If the module doesn't have any vertex stages, then there's nothing to do.
|
// If the module doesn't have any vertex stages, then there's nothing to do.
|
||||||
out.program = in->Clone();
|
out.program = in->Clone();
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -85,8 +85,8 @@ Transform::Output VertexPulling::Run(const Program* in) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find entry point
|
// Find entry point
|
||||||
auto* func = in->Functions().Find(in->GetSymbol(cfg.entry_point_name),
|
auto* func = in->AST().Functions().Find(in->GetSymbol(cfg.entry_point_name),
|
||||||
ast::PipelineStage::kVertex);
|
ast::PipelineStage::kVertex);
|
||||||
if (func == nullptr) {
|
if (func == nullptr) {
|
||||||
diag::Diagnostic err;
|
diag::Diagnostic err;
|
||||||
err.severity = diag::Severity::Error;
|
err.severity = diag::Severity::Error;
|
||||||
|
|
|
@ -126,13 +126,13 @@ bool TypeDeterminer::Determine() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DetermineFunctions(program_->Functions())) {
|
if (!DetermineFunctions(program_->AST().Functions())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk over the caller to callee information and update functions with which
|
// Walk over the caller to callee information and update functions with which
|
||||||
// entry points call those functions.
|
// entry points call those functions.
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!func->IsEntryPoint()) {
|
if (!func->IsEntryPoint()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ bool TypeDeterminer::DetermineCall(ast::CallExpression* expr) {
|
||||||
caller_to_callee_[current_function_->symbol()].push_back(
|
caller_to_callee_[current_function_->symbol()].push_back(
|
||||||
ident->symbol());
|
ident->symbol());
|
||||||
|
|
||||||
auto* callee_func = program_->Functions().Find(ident->symbol());
|
auto* callee_func = program_->AST().Functions().Find(ident->symbol());
|
||||||
if (callee_func == nullptr) {
|
if (callee_func == nullptr) {
|
||||||
set_error(expr->source(),
|
set_error(expr->source(),
|
||||||
"unable to find called function: " +
|
"unable to find called function: " +
|
||||||
|
|
|
@ -292,7 +292,7 @@ TEST_F(TypeDeterminerTest, Stmt_Call) {
|
||||||
ast::VariableList params;
|
ast::VariableList params;
|
||||||
auto* func = Func("my_func", params, ty.f32, ast::StatementList{},
|
auto* func = Func("my_func", params, ty.f32, ast::StatementList{},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
// Register the function
|
// Register the function
|
||||||
EXPECT_TRUE(td()->Determine());
|
EXPECT_TRUE(td()->Determine());
|
||||||
|
@ -319,14 +319,14 @@ TEST_F(TypeDeterminerTest, Stmt_Call_undeclared) {
|
||||||
create<ast::ReturnStatement>(),
|
create<ast::ReturnStatement>(),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func_main);
|
mod->AST().Functions().Add(func_main);
|
||||||
|
|
||||||
auto* func = Func("func", params0, ty.f32,
|
auto* func = Func("func", params0, ty.f32,
|
||||||
ast::StatementList{
|
ast::StatementList{
|
||||||
create<ast::ReturnStatement>(),
|
create<ast::ReturnStatement>(),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_FALSE(td()->Determine()) << td()->error();
|
EXPECT_FALSE(td()->Determine()) << td()->error();
|
||||||
EXPECT_EQ(td()->error(),
|
EXPECT_EQ(td()->error(),
|
||||||
|
@ -472,7 +472,7 @@ TEST_F(TypeDeterminerTest, Expr_Call) {
|
||||||
ast::VariableList params;
|
ast::VariableList params;
|
||||||
auto* func = Func("my_func", params, ty.f32, ast::StatementList{},
|
auto* func = Func("my_func", params, ty.f32, ast::StatementList{},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
// Register the function
|
// Register the function
|
||||||
EXPECT_TRUE(td()->Determine());
|
EXPECT_TRUE(td()->Determine());
|
||||||
|
@ -487,7 +487,7 @@ TEST_F(TypeDeterminerTest, Expr_Call_WithParams) {
|
||||||
ast::VariableList params;
|
ast::VariableList params;
|
||||||
auto* func = Func("my_func", params, ty.f32, ast::StatementList{},
|
auto* func = Func("my_func", params, ty.f32, ast::StatementList{},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
// Register the function
|
// Register the function
|
||||||
EXPECT_TRUE(td()->Determine());
|
EXPECT_TRUE(td()->Determine());
|
||||||
|
@ -626,7 +626,7 @@ TEST_F(TypeDeterminerTest, Expr_Identifier_Function_Ptr) {
|
||||||
TEST_F(TypeDeterminerTest, Expr_Identifier_Function) {
|
TEST_F(TypeDeterminerTest, Expr_Identifier_Function) {
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.f32,
|
auto* func = Func("my_func", ast::VariableList{}, ty.f32,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
// Register the function
|
// Register the function
|
||||||
EXPECT_TRUE(td()->Determine());
|
EXPECT_TRUE(td()->Determine());
|
||||||
|
@ -665,7 +665,7 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
// Register the function
|
// Register the function
|
||||||
EXPECT_TRUE(td()->Determine());
|
EXPECT_TRUE(td()->Determine());
|
||||||
|
@ -702,7 +702,7 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables_SubFunction) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* func2 = Func(
|
auto* func2 = Func(
|
||||||
"func", ast::VariableList{}, ty.f32,
|
"func", ast::VariableList{}, ty.f32,
|
||||||
|
@ -711,7 +711,7 @@ TEST_F(TypeDeterminerTest, Function_RegisterInputOutputVariables_SubFunction) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func2);
|
mod->AST().Functions().Add(func2);
|
||||||
|
|
||||||
// Register the function
|
// Register the function
|
||||||
EXPECT_TRUE(td()->Determine());
|
EXPECT_TRUE(td()->Determine());
|
||||||
|
@ -736,7 +736,7 @@ TEST_F(TypeDeterminerTest, Function_NotRegisterFunctionVariable) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* v = Var("var", ast::StorageClass::kFunction, ty.f32);
|
auto* v = Var("var", ast::StorageClass::kFunction, ty.f32);
|
||||||
td()->RegisterVariableForTesting(v);
|
td()->RegisterVariableForTesting(v);
|
||||||
|
@ -1589,7 +1589,7 @@ TEST_F(TypeDeterminerTest, StorageClass_SetsIfMissing) {
|
||||||
auto* func = Func("func", ast::VariableList{}, ty.i32,
|
auto* func = Func("func", ast::VariableList{}, ty.i32,
|
||||||
ast::StatementList{stmt}, ast::FunctionDecorationList{});
|
ast::StatementList{stmt}, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
EXPECT_EQ(var->storage_class(), ast::StorageClass::kFunction);
|
EXPECT_EQ(var->storage_class(), ast::StorageClass::kFunction);
|
||||||
|
@ -1601,7 +1601,7 @@ TEST_F(TypeDeterminerTest, StorageClass_DoesNotSetOnConst) {
|
||||||
auto* func = Func("func", ast::VariableList{}, ty.i32,
|
auto* func = Func("func", ast::VariableList{}, ty.i32,
|
||||||
ast::StatementList{stmt}, ast::FunctionDecorationList{});
|
ast::StatementList{stmt}, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
EXPECT_EQ(var->storage_class(), ast::StorageClass::kNone);
|
EXPECT_EQ(var->storage_class(), ast::StorageClass::kNone);
|
||||||
|
@ -1614,7 +1614,7 @@ TEST_F(TypeDeterminerTest, StorageClass_NonFunctionClassError) {
|
||||||
auto* func = Func("func", ast::VariableList{}, ty.i32,
|
auto* func = Func("func", ast::VariableList{}, ty.i32,
|
||||||
ast::StatementList{stmt}, ast::FunctionDecorationList{});
|
ast::StatementList{stmt}, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_FALSE(td()->Determine());
|
EXPECT_FALSE(td()->Determine());
|
||||||
EXPECT_EQ(td()->error(),
|
EXPECT_EQ(td()->error(),
|
||||||
|
@ -2760,11 +2760,11 @@ TEST_F(TypeDeterminerTest, Function_EntryPoints_StageDecoration) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_b);
|
mod->AST().Functions().Add(func_b);
|
||||||
mod->Functions().Add(func_c);
|
mod->AST().Functions().Add(func_c);
|
||||||
mod->Functions().Add(func_a);
|
mod->AST().Functions().Add(func_a);
|
||||||
mod->Functions().Add(ep_1);
|
mod->AST().Functions().Add(ep_1);
|
||||||
mod->Functions().Add(ep_2);
|
mod->AST().Functions().Add(ep_2);
|
||||||
|
|
||||||
mod->AST().AddGlobalVariable(
|
mod->AST().AddGlobalVariable(
|
||||||
Var("first", ast::StorageClass::kPrivate, ty.f32));
|
Var("first", ast::StorageClass::kPrivate, ty.f32));
|
||||||
|
|
|
@ -49,7 +49,7 @@ TEST_F(ValidateFunctionTest, VoidFunctionEndWithoutReturnStatement_Pass) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ TEST_F(ValidateFunctionTest,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ TEST_F(ValidateFunctionTest, FunctionEndWithoutReturnStatement_Fail) {
|
||||||
create<ast::VariableDeclStatement>(var),
|
create<ast::VariableDeclStatement>(var),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ TEST_F(ValidateFunctionTest, FunctionEndWithoutReturnStatementEmptyBody_Fail) {
|
||||||
auto* func =
|
auto* func =
|
||||||
Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{},
|
Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{},
|
||||||
ty.i32, ast::StatementList{}, ast::FunctionDecorationList{});
|
ty.i32, ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -127,13 +127,14 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_Pass) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->DetermineFunctions(mod->Functions())) << td()->error();
|
EXPECT_TRUE(td()->DetermineFunctions(mod->AST().Functions()))
|
||||||
|
<< td()->error();
|
||||||
|
|
||||||
ValidatorImpl& v = Build();
|
ValidatorImpl& v = Build();
|
||||||
|
|
||||||
EXPECT_TRUE(v.ValidateFunctions(mod->Functions())) << v.error();
|
EXPECT_TRUE(v.ValidateFunctions(mod->AST().Functions())) << v.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_fail) {
|
TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_fail) {
|
||||||
|
@ -144,7 +145,7 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_fail) {
|
||||||
Source{Source::Location{12, 34}}, Expr(2)),
|
Source{Source::Location{12, 34}}, Expr(2)),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementTypeF32_fail) {
|
||||||
Source{Source::Location{12, 34}}, Expr(2)),
|
Source{Source::Location{12, 34}}, Expr(2)),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -194,8 +195,8 @@ TEST_F(ValidateFunctionTest, FunctionNamesMustBeUnique_fail) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
mod->Functions().Add(func_copy);
|
mod->AST().Functions().Add(func_copy);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -217,7 +218,7 @@ TEST_F(ValidateFunctionTest, RecursionIsNotAllowed_Fail) {
|
||||||
create<ast::ReturnStatement>(),
|
create<ast::ReturnStatement>(),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func0);
|
mod->AST().Functions().Add(func0);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ TEST_F(ValidateFunctionTest, RecursionIsNotAllowedExpr_Fail) {
|
||||||
create<ast::ReturnStatement>(Expr(2)),
|
create<ast::ReturnStatement>(Expr(2)),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func0);
|
mod->AST().Functions().Add(func0);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -263,7 +264,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_NotVoid_Fail) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
ValidatorImpl& v = Build();
|
ValidatorImpl& v = Build();
|
||||||
|
@ -288,7 +289,7 @@ TEST_F(ValidateFunctionTest, Function_WithPipelineStage_WithParams_Fail) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
ValidatorImpl& v = Build();
|
ValidatorImpl& v = Build();
|
||||||
|
@ -313,7 +314,7 @@ TEST_F(ValidateFunctionTest, PipelineStage_MustBeUnique_Fail) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
ValidatorImpl& v = Build();
|
ValidatorImpl& v = Build();
|
||||||
|
@ -335,7 +336,7 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Pass) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -351,7 +352,7 @@ TEST_F(ValidateFunctionTest, OnePipelineStageFunctionMustBePresent_Fail) {
|
||||||
create<ast::ReturnStatement>(),
|
create<ast::ReturnStatement>(),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
|
|
@ -71,10 +71,10 @@ bool ValidatorImpl::Validate() {
|
||||||
if (!ValidateConstructedTypes(program_->AST().ConstructedTypes())) {
|
if (!ValidateConstructedTypes(program_->AST().ConstructedTypes())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ValidateFunctions(program_->Functions())) {
|
if (!ValidateFunctions(program_->AST().Functions())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ValidateEntryPoint(program_->Functions())) {
|
if (!ValidateEntryPoint(program_->AST().Functions())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function_stack_.pop_scope();
|
function_stack_.pop_scope();
|
||||||
|
|
|
@ -394,7 +394,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Fail) {
|
||||||
Source{Source::Location{12, 34}}, lhs, rhs),
|
Source{Source::Location{12, 34}}, lhs, rhs),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ValidatorImpl& v = Build();
|
ValidatorImpl& v = Build();
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ TEST_F(ValidatorTest, UsingUndefinedVariableGlobalVariable_Pass) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ TEST_F(ValidatorTest, GlobalVariableFunctionVariableNotUnique_Fail) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error();
|
EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error();
|
||||||
|
@ -612,7 +612,7 @@ TEST_F(ValidatorTest, RedeclaredIndentifier_Fail) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error();
|
EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error();
|
||||||
|
@ -711,8 +711,8 @@ TEST_F(ValidatorTest, RedeclaredIdentifierDifferentFunctions_Pass) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func0);
|
mod->AST().Functions().Add(func0);
|
||||||
mod->Functions().Add(func1);
|
mod->AST().Functions().Add(func1);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayInFunction_Fail) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayAsParameter_Fail) {
|
||||||
create<ast::ReturnStatement>(),
|
create<ast::ReturnStatement>(),
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* main =
|
auto* main =
|
||||||
Func("main", ast::VariableList{}, ty.void_,
|
Func("main", ast::VariableList{}, ty.void_,
|
||||||
|
@ -207,7 +207,7 @@ TEST_F(ValidatorTypeTest, RuntimeArrayAsParameter_Fail) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(main);
|
mod->AST().Functions().Add(main);
|
||||||
|
|
||||||
EXPECT_TRUE(td()->Determine()) << td()->error();
|
EXPECT_TRUE(td()->Determine()) << td()->error();
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ bool GeneratorImpl::Generate(std::ostream& out) {
|
||||||
|
|
||||||
std::unordered_set<Symbol> emitted_globals;
|
std::unordered_set<Symbol> emitted_globals;
|
||||||
// Make sure all entry point data is emitted before the entry point functions
|
// Make sure all entry point data is emitted before the entry point functions
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!func->IsEntryPoint()) {
|
if (!func->IsEntryPoint()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -170,13 +170,13 @@ bool GeneratorImpl::Generate(std::ostream& out) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!EmitFunction(out, func)) {
|
if (!EmitFunction(out, func)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!func->IsEntryPoint()) {
|
if (!func->IsEntryPoint()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ bool GeneratorImpl::EmitCall(std::ostream& pre,
|
||||||
name = it->second;
|
name = it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* func = program_->Functions().Find(ident->symbol());
|
auto* func = program_->AST().Functions().Find(ident->symbol());
|
||||||
if (func == nullptr) {
|
if (func == nullptr) {
|
||||||
error_ =
|
error_ =
|
||||||
"Unable to find function: " + program_->SymbolToName(ident->symbol());
|
"Unable to find function: " + program_->SymbolToName(ident->symbol());
|
||||||
|
|
|
@ -507,7 +507,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Call_WithLogical) {
|
||||||
|
|
||||||
auto* func = Func("foo", ast::VariableList{}, ty.void_, ast::StatementList{},
|
auto* func = Func("foo", ast::VariableList{}, ty.void_, ast::StatementList{},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ast::ExpressionList params;
|
ast::ExpressionList params;
|
||||||
params.push_back(create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd,
|
params.push_back(create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd,
|
||||||
|
|
|
@ -34,7 +34,7 @@ TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithoutParams) {
|
||||||
|
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ TEST_F(HlslGeneratorImplTest_Call, EmitExpression_Call_WithParams) {
|
||||||
|
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ TEST_F(HlslGeneratorImplTest_Call, EmitStatement_Call) {
|
||||||
|
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ TEST_F(HlslGeneratorImplTest_EntryPoint,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
std::unordered_set<Symbol> globals;
|
std::unordered_set<Symbol> globals;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_Name_Collision) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithParams) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ TEST_F(
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto* func_1 = Func(
|
auto* func_1 = Func(
|
||||||
"ep_1", ast::VariableList{}, ty.void_,
|
"ep_1", ast::VariableList{}, ty.void_,
|
||||||
|
@ -594,7 +594,7 @@ TEST_F(
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto* func_1 =
|
auto* func_1 =
|
||||||
Func("ep_1", ast::VariableList{}, ty.void_,
|
Func("ep_1", ast::VariableList{}, ty.void_,
|
||||||
|
@ -659,7 +659,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ TEST_F(
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto* func_1 =
|
auto* func_1 =
|
||||||
Func("ep_1", ast::VariableList{}, ty.void_,
|
Func("ep_1", ast::VariableList{}, ty.void_,
|
||||||
|
@ -728,7 +728,7 @@ TEST_F(
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto* var = Var("v", ast::StorageClass::kFunction, ty.f32,
|
auto* var = Var("v", ast::StorageClass::kFunction, ty.f32,
|
||||||
Call("sub_func", 1.0f), ast::VariableDecorationList{});
|
Call("sub_func", 1.0f), ast::VariableDecorationList{});
|
||||||
|
@ -794,7 +794,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto* var = Var("v", ast::StorageClass::kFunction, ty.f32,
|
auto* var = Var("v", ast::StorageClass::kFunction, ty.f32,
|
||||||
Call("sub_func", 1.0f), ast::VariableDecorationList{});
|
Call("sub_func", 1.0f), ast::VariableDecorationList{});
|
||||||
|
@ -854,7 +854,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -933,7 +933,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -983,7 +983,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::WorkgroupDecoration>(2u, 4u, 6u),
|
create<ast::WorkgroupDecoration>(2u, 4u, 6u),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -1008,7 +1008,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -1071,7 +1071,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1088,7 +1088,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
|
@ -30,7 +30,7 @@ using HlslGeneratorImplTest = TestHelper;
|
||||||
TEST_F(HlslGeneratorImplTest, Generate) {
|
TEST_F(HlslGeneratorImplTest, Generate) {
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ bool GeneratorImpl::Generate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure all entry point data is emitted before the entry point functions
|
// Make sure all entry point data is emitted before the entry point functions
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!func->IsEntryPoint()) {
|
if (!func->IsEntryPoint()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -148,13 +148,13 @@ bool GeneratorImpl::Generate() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!EmitFunction(func)) {
|
if (!EmitFunction(func)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!func->IsEntryPoint()) {
|
if (!func->IsEntryPoint()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ bool GeneratorImpl::EmitCall(ast::CallExpression* expr) {
|
||||||
name = it->second;
|
name = it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* func = program_->Functions().Find(ident->symbol());
|
auto* func = program_->AST().Functions().Find(ident->symbol());
|
||||||
if (func == nullptr) {
|
if (func == nullptr) {
|
||||||
error_ =
|
error_ =
|
||||||
"Unable to find function: " + program_->SymbolToName(ident->symbol());
|
"Unable to find function: " + program_->SymbolToName(ident->symbol());
|
||||||
|
|
|
@ -35,7 +35,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithoutParams) {
|
||||||
auto* call = Call("my_func");
|
auto* call = Call("my_func");
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ TEST_F(MslGeneratorImplTest, EmitExpression_Call_WithParams) {
|
||||||
auto* call = Call("my_func", "param1", "param2");
|
auto* call = Call("my_func", "param1", "param2");
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ TEST_F(MslGeneratorImplTest, EmitStatement_Call) {
|
||||||
auto* call = Call("my_func", "param1", "param2");
|
auto* call = Call("my_func", "param1", "param2");
|
||||||
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
auto* func = Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{}, ast::FunctionDecorationList{});
|
ast::StatementList{}, ast::FunctionDecorationList{});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
auto* expr = create<ast::CallStatement>(call);
|
auto* expr = create<ast::CallStatement>(call);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Input) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Vertex_Output) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Input) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Fragment_Output) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Input) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Compute_Output) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_EntryPointData_Builtins) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_Name_Collision) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithParams) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_NoReturn_Void) {
|
||||||
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
||||||
ast::PipelineStage::kFragment)});
|
ast::PipelineStage::kFragment)});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment)});
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment)});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_WithInOutVars) {
|
||||||
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
ast::FunctionDecorationList{create<ast::StageDecoration>(
|
||||||
ast::PipelineStage::kFragment)});
|
ast::PipelineStage::kFragment)});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ TEST_F(MslGeneratorImplTest, Emit_FunctionDecoration_EntryPoint_With_Uniform) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ TEST_F(
|
||||||
auto* sub_func =
|
auto* sub_func =
|
||||||
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
body = ast::StatementList{
|
body = ast::StatementList{
|
||||||
create<ast::AssignmentStatement>(Expr("bar"), Call("sub_func", 1.0f)),
|
create<ast::AssignmentStatement>(Expr("bar"), Call("sub_func", 1.0f)),
|
||||||
|
@ -495,7 +495,7 @@ TEST_F(
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto body = ast::StatementList{
|
auto body = ast::StatementList{
|
||||||
create<ast::AssignmentStatement>(Expr("depth"), Call("sub_func", 1.0f)),
|
create<ast::AssignmentStatement>(Expr("depth"), Call("sub_func", 1.0f)),
|
||||||
|
@ -560,7 +560,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ TEST_F(
|
||||||
auto* sub_func =
|
auto* sub_func =
|
||||||
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
body = ast::StatementList{
|
body = ast::StatementList{
|
||||||
create<ast::AssignmentStatement>(Expr("depth"), Call("sub_func", 1.0f)),
|
create<ast::AssignmentStatement>(Expr("depth"), Call("sub_func", 1.0f)),
|
||||||
|
@ -628,7 +628,7 @@ TEST_F(
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* sub_func =
|
auto* sub_func =
|
||||||
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
ast::ExpressionList expr;
|
ast::ExpressionList expr;
|
||||||
expr.push_back(Expr(1.0f));
|
expr.push_back(Expr(1.0f));
|
||||||
|
@ -692,7 +692,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* sub_func =
|
auto* sub_func =
|
||||||
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
auto* var = Var("v", ast::StorageClass::kFunction, ty.f32,
|
auto* var = Var("v", ast::StorageClass::kFunction, ty.f32,
|
||||||
Call("sub_func", 1.0f), ast::VariableDecorationList{});
|
Call("sub_func", 1.0f), ast::VariableDecorationList{});
|
||||||
|
@ -756,7 +756,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
auto* sub_func =
|
auto* sub_func =
|
||||||
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
Func("sub_func", params, ty.f32, body, ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(sub_func);
|
mod->AST().Functions().Add(sub_func);
|
||||||
|
|
||||||
ast::ExpressionList expr;
|
ast::ExpressionList expr;
|
||||||
expr.push_back(Expr(1.0f));
|
expr.push_back(Expr(1.0f));
|
||||||
|
@ -828,7 +828,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -881,7 +881,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func_1);
|
mod->AST().Functions().Add(func_1);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
@ -914,7 +914,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -938,7 +938,7 @@ TEST_F(MslGeneratorImplTest, Emit_Function_WithArrayParams) {
|
||||||
},
|
},
|
||||||
ast::FunctionDecorationList{});
|
ast::FunctionDecorationList{});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1018,7 +1018,7 @@ TEST_F(MslGeneratorImplTest,
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute)});
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute)});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
|
@ -53,7 +53,7 @@ TEST_F(MslGeneratorImplTest, Generate) {
|
||||||
ast::FunctionDecorationList{
|
ast::FunctionDecorationList{
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ bool Builder::Build() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!GenerateFunction(func)) {
|
if (!GenerateFunction(func)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ TEST_F(BuilderTest, Emit_Multiple_EntryPoint_With_Same_ModuleVar) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
|
@ -4165,7 +4165,7 @@ TEST_P(IntrinsicTextureTest, ValidateSPIRV) {
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(main);
|
mod->AST().Functions().Add(main);
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ bool GeneratorImpl::Generate() {
|
||||||
out_ << std::endl;
|
out_ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* func : program_->Functions()) {
|
for (auto* func : program_->AST().Functions()) {
|
||||||
if (!EmitFunction(func)) {
|
if (!EmitFunction(func)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,8 @@ bool GeneratorImpl::Generate() {
|
||||||
|
|
||||||
bool GeneratorImpl::GenerateEntryPoint(ast::PipelineStage stage,
|
bool GeneratorImpl::GenerateEntryPoint(ast::PipelineStage stage,
|
||||||
const std::string& name) {
|
const std::string& name) {
|
||||||
auto* func = program_->Functions().Find(program_->GetSymbol(name), stage);
|
auto* func =
|
||||||
|
program_->AST().Functions().Find(program_->GetSymbol(name), stage);
|
||||||
if (func == nullptr) {
|
if (func == nullptr) {
|
||||||
error_ = "Unable to find requested entry point: " + name;
|
error_ = "Unable to find requested entry point: " + name;
|
||||||
return false;
|
return false;
|
||||||
|
@ -152,7 +153,7 @@ bool GeneratorImpl::GenerateEntryPoint(ast::PipelineStage stage,
|
||||||
out_ << std::endl;
|
out_ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto* f : program_->Functions()) {
|
for (auto* f : program_->AST().Functions()) {
|
||||||
if (!f->HasAncestorEntryPoint(program_->GetSymbol(name))) {
|
if (!f->HasAncestorEntryPoint(program_->GetSymbol(name))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ TEST_F(WgslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ TEST_F(WgslGeneratorImplTest,
|
||||||
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
create<ast::StageDecoration>(ast::PipelineStage::kCompute),
|
||||||
});
|
});
|
||||||
|
|
||||||
mod->Functions().Add(func);
|
mod->AST().Functions().Add(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_TRUE(td.Determine()) << td.error();
|
ASSERT_TRUE(td.Determine()) << td.error();
|
||||||
|
|
|
@ -30,9 +30,9 @@ namespace {
|
||||||
using WgslGeneratorImplTest = TestHelper;
|
using WgslGeneratorImplTest = TestHelper;
|
||||||
|
|
||||||
TEST_F(WgslGeneratorImplTest, Generate) {
|
TEST_F(WgslGeneratorImplTest, Generate) {
|
||||||
mod->Functions().Add(Func("my_func", ast::VariableList{}, ty.void_,
|
mod->AST().Functions().Add(Func("my_func", ast::VariableList{}, ty.void_,
|
||||||
ast::StatementList{},
|
ast::StatementList{},
|
||||||
ast::FunctionDecorationList{}));
|
ast::FunctionDecorationList{}));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue