mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 07:06:11 +00:00
Cleanup code using RegisterSymbol
This CL goes through and converts things which call RegisterSymbol to use the helper builders. Several variables are also updated to use the helper as it will need RegisterSymbol in the near future. Change-Id: Ib5a8e8be54c1eaad123384fab09f6625421d9fcd Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35880 Commit-Queue: dan sinclair <dsinclair@chromium.org> Commit-Queue: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com> Auto-Submit: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
e5d288be5e
commit
b5839939e1
@@ -71,12 +71,7 @@ TEST_F(FirstIndexOffsetTest, Error_AlreadyTransformed) {
|
||||
struct Builder : public ModuleBuilder {
|
||||
void Build() override {
|
||||
AddBuiltinInput("vert_idx", ast::Builtin::kVertexIdx);
|
||||
AddFunction(
|
||||
"test",
|
||||
{
|
||||
create<ast::ReturnStatement>(create<ast::IdentifierExpression>(
|
||||
mod->RegisterSymbol("vert_idx"), "vert_idx")),
|
||||
});
|
||||
AddFunction("test", {create<ast::ReturnStatement>(Expr("vert_idx"))});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -116,12 +111,7 @@ TEST_F(FirstIndexOffsetTest, BasicModuleVertexIndex) {
|
||||
struct Builder : public ModuleBuilder {
|
||||
void Build() override {
|
||||
AddBuiltinInput("vert_idx", ast::Builtin::kVertexIdx);
|
||||
AddFunction(
|
||||
"test",
|
||||
{
|
||||
create<ast::ReturnStatement>(create<ast::IdentifierExpression>(
|
||||
mod->RegisterSymbol("vert_idx"), "vert_idx")),
|
||||
});
|
||||
AddFunction("test", {create<ast::ReturnStatement>(Expr("vert_idx"))});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -196,12 +186,7 @@ TEST_F(FirstIndexOffsetTest, BasicModuleInstanceIndex) {
|
||||
struct Builder : public ModuleBuilder {
|
||||
void Build() override {
|
||||
AddBuiltinInput("inst_idx", ast::Builtin::kInstanceIdx);
|
||||
AddFunction(
|
||||
"test",
|
||||
{
|
||||
create<ast::ReturnStatement>(create<ast::IdentifierExpression>(
|
||||
mod->RegisterSymbol("inst_idx"), "inst_idx")),
|
||||
});
|
||||
AddFunction("test", {create<ast::ReturnStatement>(Expr("inst_idx"))});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -353,19 +338,8 @@ TEST_F(FirstIndexOffsetTest, NestedCalls) {
|
||||
struct Builder : public ModuleBuilder {
|
||||
void Build() override {
|
||||
AddBuiltinInput("vert_idx", ast::Builtin::kVertexIdx);
|
||||
AddFunction(
|
||||
"func1",
|
||||
{
|
||||
create<ast::ReturnStatement>(create<ast::IdentifierExpression>(
|
||||
mod->RegisterSymbol("vert_idx"), "vert_idx")),
|
||||
});
|
||||
AddFunction("func2",
|
||||
{
|
||||
create<ast::ReturnStatement>(create<ast::CallExpression>(
|
||||
create<ast::IdentifierExpression>(
|
||||
mod->RegisterSymbol("func1"), "func1"),
|
||||
ast::ExpressionList{})),
|
||||
});
|
||||
AddFunction("func1", {create<ast::ReturnStatement>(Expr("vert_idx"))});
|
||||
AddFunction("func2", {create<ast::ReturnStatement>(Call("func1"))});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user