aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2016-10-18 08:16:41 -0400
committerGravatar Ethan Nicholas <ethannicholas@google.com>2016-10-18 12:18:33 +0000
commit311742bd0eac6fad150bf8f0a4e2809679464e47 (patch)
treea0c63d19850212b2b4c1353f6305d619dec381e3 /src/sksl/ir
parent4f2a88cdf0e72d6cdf8d870c5130f45c70c48e09 (diff)
skslc now automatically turns on derivatives support
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3569 Change-Id: I211f4a80ced951a0d2f29763f85fe75a5daccff7 Reviewed-on: https://skia-review.googlesource.com/3569 Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'src/sksl/ir')
-rw-r--r--src/sksl/ir/SkSLFunctionDeclaration.h2
-rw-r--r--src/sksl/ir/SkSLSymbolTable.cpp18
-rw-r--r--src/sksl/ir/SkSLSymbolTable.h2
3 files changed, 22 insertions, 0 deletions
diff --git a/src/sksl/ir/SkSLFunctionDeclaration.h b/src/sksl/ir/SkSLFunctionDeclaration.h
index 16a184a6d7..ffde0c66c1 100644
--- a/src/sksl/ir/SkSLFunctionDeclaration.h
+++ b/src/sksl/ir/SkSLFunctionDeclaration.h
@@ -24,6 +24,7 @@ struct FunctionDeclaration : public Symbol {
std::vector<const Variable*> parameters, const Type& returnType)
: INHERITED(position, kFunctionDeclaration_Kind, std::move(name))
, fDefined(false)
+ , fBuiltin(false)
, fParameters(std::move(parameters))
, fReturnType(returnType) {}
@@ -55,6 +56,7 @@ struct FunctionDeclaration : public Symbol {
}
mutable bool fDefined;
+ bool fBuiltin;
const std::vector<const Variable*> fParameters;
const Type& fReturnType;
diff --git a/src/sksl/ir/SkSLSymbolTable.cpp b/src/sksl/ir/SkSLSymbolTable.cpp
index 9d8c0063c5..6d8e9a7ea6 100644
--- a/src/sksl/ir/SkSLSymbolTable.cpp
+++ b/src/sksl/ir/SkSLSymbolTable.cpp
@@ -97,4 +97,22 @@ void SymbolTable::addWithoutOwnership(const std::string& name, const Symbol* sym
}
}
+
+void SymbolTable::markAllFunctionsBuiltin() {
+ for (const auto& pair : fSymbols) {
+ switch (pair.second->fKind) {
+ case Symbol::kFunctionDeclaration_Kind:
+ ((FunctionDeclaration&) *pair.second).fBuiltin = true;
+ break;
+ case Symbol::kUnresolvedFunction_Kind:
+ for (auto& f : ((UnresolvedFunction&) *pair.second).fFunctions) {
+ ((FunctionDeclaration*) f)->fBuiltin = true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
} // namespace
diff --git a/src/sksl/ir/SkSLSymbolTable.h b/src/sksl/ir/SkSLSymbolTable.h
index d732023ff0..be2b49c48d 100644
--- a/src/sksl/ir/SkSLSymbolTable.h
+++ b/src/sksl/ir/SkSLSymbolTable.h
@@ -39,6 +39,8 @@ public:
Symbol* takeOwnership(Symbol* s);
+ void markAllFunctionsBuiltin();
+
const std::shared_ptr<SymbolTable> fParent;
private: