diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-04-24 13:06:09 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-25 16:53:27 +0000 |
commit | 3c6ae62e0f9faeab0242fca2d19d61e64a7c8a6e (patch) | |
tree | 68e1ebf040d2027349fc702ab7bf384d88a79ea3 /src/sksl/SkSLIRGenerator.cpp | |
parent | f8f1839cc8ab08657ab4c6419726af3d20da4666 (diff) |
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>
Diffstat (limited to 'src/sksl/SkSLIRGenerator.cpp')
-rw-r--r-- | src/sksl/SkSLIRGenerator.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp index a0de551bb3..c081fd7017 100644 --- a/src/sksl/SkSLIRGenerator.cpp +++ b/src/sksl/SkSLIRGenerator.cpp @@ -142,7 +142,8 @@ static void fill_caps(const SKSL_CAPS_CLASS& caps, #undef CAP } -void IRGenerator::start(const Program::Settings* settings) { +void IRGenerator::start(const Program::Settings* settings, + std::vector<std::unique_ptr<ProgramElement>>* inherited) { fSettings = settings; fCapsMap.clear(); if (settings->fCaps) { @@ -154,6 +155,17 @@ void IRGenerator::start(const Program::Settings* settings) { fSkPerVertex = nullptr; fRTAdjust = nullptr; fRTAdjustInterfaceBlock = nullptr; + if (inherited) { + for (const auto& e : *inherited) { + if (e->fKind == ProgramElement::kInterfaceBlock_Kind) { + InterfaceBlock& intf = (InterfaceBlock&) *e; + if (intf.fVariable.fName == Compiler::PERVERTEX_NAME) { + ASSERT(!fSkPerVertex); + fSkPerVertex = &intf.fVariable; + } + } + } + } } void IRGenerator::finish() { @@ -861,10 +873,6 @@ std::unique_ptr<InterfaceBlock> IRGenerator::convertInterfaceBlock(const ASTInte (int) i))); } } - if (var->fName == Compiler::PERVERTEX_NAME) { - ASSERT(!fSkPerVertex); - fSkPerVertex = var; - } return std::unique_ptr<InterfaceBlock>(new InterfaceBlock(intf.fOffset, var, intf.fTypeName, |