cache SkSL headers
This reduces the cost of successive shader compilations by caching the
results of compiling SkSL's headers.
Bug: skia:
Change-Id: If7fc21a9877021c4025ad99dd0981523a25855e0
Reviewed-on: https://skia-review.googlesource.com/123422
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLInterpreter.cpp b/src/sksl/SkSLInterpreter.cpp
index c9b7ceb..45e340a 100644
--- a/src/sksl/SkSLInterpreter.cpp
+++ b/src/sksl/SkSLInterpreter.cpp
@@ -29,9 +29,9 @@
namespace SkSL {
void Interpreter::run() {
- for (const auto& e : fProgram->fElements) {
- if (ProgramElement::kFunction_Kind == e->fKind) {
- const FunctionDefinition& f = (const FunctionDefinition&) *e;
+ for (const auto& e : *fProgram) {
+ if (ProgramElement::kFunction_Kind == e.fKind) {
+ const FunctionDefinition& f = (const FunctionDefinition&) e;
if ("appendStages" == f.fDeclaration.fName) {
this->run(f);
return;
@@ -244,9 +244,9 @@
CallbackCtx* ctx = new CallbackCtx();
ctx->fInterpreter = this;
ctx->fn = do_callback;
- for (const auto& e : fProgram->fElements) {
- if (ProgramElement::kFunction_Kind == e->fKind) {
- const FunctionDefinition& f = (const FunctionDefinition&) *e;
+ for (const auto& e : *fProgram) {
+ if (ProgramElement::kFunction_Kind == e.fKind) {
+ const FunctionDefinition& f = (const FunctionDefinition&) e;
if (&f.fDeclaration ==
((const FunctionReference&) *a.fArguments[0]).fFunctions[0]) {
ctx->fFunction = &f;