Allow Mangler to be used outside of Inliner.
It now lives in the Compiler instead of the Inliner, and we have a
pointer to it inside the Context. I also took the opportunity to remove
a few unnecessary #includes from Context and fixed up the fallout from
this.
POTENTIALLY IMPORTANT FOOTNOTE: DSLWriter has its own Mangler object
inside of it. I experimented with removing this and having it share the
Mangler object inside the Context, but this caused failures in
"testThreading" and "testpersistentcache" CQ bots; the Expected and
Actual images would mismatch. (The Expected would be missing some
draws.) This particularly affected some blur-related tests which are
likely to be GaussianConvolution--i.e. it uses DSL.
This might be a canary in the coalmine for some quirky DSL threading
issue? e.g. using the same Context on two threads at once?
Change-Id: I2290b810d9487c40a3dbef119c95d1572b14a5ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449357
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index 3c5465b..5c05901 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -275,7 +275,7 @@
}
void Inliner::reset() {
- fMangler.reset();
+ fContext->fMangler->reset();
fInlinedStatementCounter = 0;
}
@@ -556,7 +556,7 @@
// regard, but see `InlinerAvoidsVariableNameOverlap` for a counterexample where unique
// names are important.
const String* name = symbolTableForStatement->takeOwnershipOfString(
- fMangler.uniqueName(variable.name(), symbolTableForStatement));
+ fContext->fMangler->uniqueName(variable.name(), symbolTableForStatement));
auto clonedVar = std::make_unique<Variable>(
offset,
&variable.modifiers(),
@@ -597,8 +597,8 @@
SkASSERT(!(modifiers.fFlags & Modifiers::kOut_Flag));
// Provide our new variable with a unique name, and add it to our symbol table.
- const String* name =
- symbolTable->takeOwnershipOfString(fMangler.uniqueName(baseName, symbolTable));
+ const String* name = symbolTable->takeOwnershipOfString(
+ fContext->fMangler->uniqueName(baseName, symbolTable));
// Create our new variable and add it to the symbol table.
InlineVariable result;