aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2016-10-20 09:54:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-20 09:54:00 -0700
commitddb37d67ba4db42fa5c6012b58d0f4985b454dc0 (patch)
treeb456baa999164506a397509b20be0c8fdc413f7a /src/sksl/ir
parent4a5e49dc6e970c4edb21f0797774082181682163 (diff)
re-re-land of skslc now automatically turns on derivatives support
Only change from last attempt is putting the call to shaderDerivativeExtensionString behind a check for shaderDerivativeSupport to avoid a spurious assertion failure. TBR=benjaminwagner@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2437063002 Review-Url: https://chromiumcodereview.appspot.com/2437063002
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: