Initial land of DSLParser
The DSLParser is an alternative to the existing SkSLParser which goes
directly to IR code using the SkSL DSL. It is substantially faster and
simpler than the existing parser->IRGenerator pipeline, but not yet
feature complete nor fully tested.
Change-Id: Iee45e9b527a3b88faa2ea74fc512051c8a38c5d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400622
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/dsl/priv/DSLWriter.cpp b/src/sksl/dsl/priv/DSLWriter.cpp
index a4eb878..edef9e0 100644
--- a/src/sksl/dsl/priv/DSLWriter.cpp
+++ b/src/sksl/dsl/priv/DSLWriter.cpp
@@ -239,10 +239,16 @@
var.storage());
SkSL::Variable* varPtr = skslvar.get();
// We can't call VarDeclaration::Convert directly here, because the IRGenerator has special
- // treatment for sk_FragColor that we want to preserve in DSL.
+ // treatment for sk_FragColor that we want to preserve in DSL. We also do not want the
+ // variable added to the symbol table for several reasons - DSLParser handles the symbol
+ // table itself, parameters don't go into the symbol table until after the
+ // FunctionDeclaration is created which makes this the wrong spot for them, and outside of
+ // DSLParser we don't even need DSL variables to show up in the symbol table in the first
+ // place.
var.fDeclaration = DSLWriter::IRGenerator().convertVarDeclaration(
- std::move(skslvar),
- var.fInitialValue.releaseIfValid());
+ std::move(skslvar),
+ var.fInitialValue.releaseIfValid(),
+ /*addToSymbolTable=*/false);
if (var.fDeclaration) {
var.fVar = varPtr;
}
diff --git a/src/sksl/dsl/priv/DSLWriter.h b/src/sksl/dsl/priv/DSLWriter.h
index 9fc7151..81ab9ab 100644
--- a/src/sksl/dsl/priv/DSLWriter.h
+++ b/src/sksl/dsl/priv/DSLWriter.h
@@ -8,6 +8,7 @@
#ifndef SKSL_DSLWRITER
#define SKSL_DSLWRITER
+#include "include/core/SkStringView.h"
#include "include/private/SkSLModifiers.h"
#include "include/private/SkSLStatement.h"
#include "include/sksl/DSLExpression.h"