From ddb37d67ba4db42fa5c6012b58d0f4985b454dc0 Mon Sep 17 00:00:00 2001 From: ethannicholas Date: Thu, 20 Oct 2016 09:54:00 -0700 Subject: 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 --- src/sksl/ir/SkSLFunctionDeclaration.h | 2 ++ src/sksl/ir/SkSLSymbolTable.cpp | 18 ++++++++++++++++++ src/sksl/ir/SkSLSymbolTable.h | 2 ++ 3 files changed, 22 insertions(+) (limited to 'src/sksl/ir') 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 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 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 fParent; private: -- cgit v1.2.3