Separate out SymbolTable aliases from regular Symbols.
SymbolTable::addAlias can be used to create a Symbol that's an alias for
an existing symbol, but uses a different name. (e.g. in Runtime Effects,
a `fragmentProcessor` is a `shader` and `float4` is also `vec4`.)
SymbolTable::addWithoutOwnership will now assert if an attempt is made
to add a Symbol with the wrong name. In a followup CL, the name argument
will be removed entirely and it will simply use the Symbol's name.
Change-Id: I9aee7717e2600a6d84ebe4c3ab7fca40229faa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323106
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLDehydrator.cpp b/src/sksl/SkSLDehydrator.cpp
index f732451..ec039d8 100644
--- a/src/sksl/SkSLDehydrator.cpp
+++ b/src/sksl/SkSLDehydrator.cpp
@@ -40,6 +40,7 @@
#include "src/sksl/ir/SkSLSwitchStatement.h"
#include "src/sksl/ir/SkSLSwizzle.h"
#include "src/sksl/ir/SkSLSymbol.h"
+#include "src/sksl/ir/SkSLSymbolAlias.h"
#include "src/sksl/ir/SkSLSymbolTable.h"
#include "src/sksl/ir/SkSLTernaryExpression.h"
#include "src/sksl/ir/SkSLUnresolvedFunction.h"
@@ -157,6 +158,14 @@
this->write(f.fReturnType);
break;
}
+ case Symbol::Kind::kSymbolAlias: {
+ const SymbolAlias& alias = s.as<SymbolAlias>();
+ this->writeU8(Rehydrator::kSymbolAlias_Command);
+ this->writeId(&alias);
+ this->write(alias.name());
+ this->write(*alias.origSymbol());
+ break;
+ }
case Symbol::Kind::kUnresolvedFunction: {
const UnresolvedFunction& f = s.as<UnresolvedFunction>();
this->writeU8(Rehydrator::kUnresolvedFunction_Command);