SkSL include files are now stored in a binary format
This speeds up compiler construction, because we no longer have to parse
and process a bunch of SkSL source code during startup.
Change-Id: I6d6bd9b5ce78b1661be691708ab84bf399c6df8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305717
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h
index 2350751..47f3316 100644
--- a/src/sksl/SkSLCompiler.h
+++ b/src/sksl/SkSLCompiler.h
@@ -158,7 +158,7 @@
/**
* Takes ownership of the given symbol. It will be destroyed when the compiler is destroyed.
*/
- Symbol* takeOwnership(std::unique_ptr<Symbol> symbol);
+ const Symbol* takeOwnership(std::unique_ptr<const Symbol> symbol);
void error(int offset, String msg) override;
@@ -178,12 +178,19 @@
static bool IsAssignment(Token::Kind token);
-private:
void processIncludeFile(Program::Kind kind, const char* src, size_t length,
std::shared_ptr<SymbolTable> base,
std::vector<std::unique_ptr<ProgramElement>>* outElements,
std::shared_ptr<SymbolTable>* outSymbolTable);
+private:
+
+ void loadGeometryIntrinsics();
+
+ void loadInterpreterIntrinsics();
+
+ void loadPipelineIntrinsics();
+
void addDefinition(const Expression* lvalue, std::unique_ptr<Expression>* expr,
DefinitionMap* definitions);
@@ -219,10 +226,10 @@
Position position(int offset);
+ std::shared_ptr<SymbolTable> fGpuSymbolTable;
std::map<String, std::pair<std::unique_ptr<ProgramElement>, bool>> fGPUIntrinsics;
std::map<String, std::pair<std::unique_ptr<ProgramElement>, bool>> fInterpreterIntrinsics;
std::unique_ptr<ASTFile> fGpuIncludeSource;
- std::shared_ptr<SymbolTable> fGpuSymbolTable;
std::vector<std::unique_ptr<ProgramElement>> fVertexInclude;
std::shared_ptr<SymbolTable> fVertexSymbolTable;
std::vector<std::unique_ptr<ProgramElement>> fFragmentInclude;
@@ -231,8 +238,10 @@
std::shared_ptr<SymbolTable> fGeometrySymbolTable;
std::vector<std::unique_ptr<ProgramElement>> fPipelineInclude;
std::shared_ptr<SymbolTable> fPipelineSymbolTable;
- std::vector<std::unique_ptr<ProgramElement>> fInterpreterInclude;
std::shared_ptr<SymbolTable> fInterpreterSymbolTable;
+ std::vector<std::unique_ptr<ProgramElement>> fInterpreterInclude;
+ std::vector<std::unique_ptr<ProgramElement>> fFPInclude;
+ std::shared_ptr<SymbolTable> fFPSymbolTable;
std::shared_ptr<SymbolTable> fTypes;
IRGenerator* fIRGenerator;