| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SKSL_COMPILER | 8 #ifndef SKSL_COMPILER |
| 9 #define SKSL_COMPILER | 9 #define SKSL_COMPILER |
| 10 | 10 |
| 11 #include <set> |
| 11 #include <vector> | 12 #include <vector> |
| 12 #include "ir/SkSLProgram.h" | 13 #include "ir/SkSLProgram.h" |
| 13 #include "ir/SkSLSymbolTable.h" | 14 #include "ir/SkSLSymbolTable.h" |
| 15 #include "SkSLCFGGenerator.h" |
| 14 #include "SkSLContext.h" | 16 #include "SkSLContext.h" |
| 15 #include "SkSLErrorReporter.h" | 17 #include "SkSLErrorReporter.h" |
| 16 #include "SkSLGLSLCodeGenerator.h" | 18 #include "SkSLGLSLCodeGenerator.h" |
| 17 | 19 |
| 18 #define SK_FRAGCOLOR_BUILTIN 10001 | 20 #define SK_FRAGCOLOR_BUILTIN 10001 |
| 19 | 21 |
| 20 namespace SkSL { | 22 namespace SkSL { |
| 21 | 23 |
| 22 class IRGenerator; | 24 class IRGenerator; |
| 23 | 25 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 | 47 |
| 46 bool toGLSL(Program::Kind kind, const std::string& text, GLCaps caps, std::s
tring* out); | 48 bool toGLSL(Program::Kind kind, const std::string& text, GLCaps caps, std::s
tring* out); |
| 47 | 49 |
| 48 void error(Position position, std::string msg) override; | 50 void error(Position position, std::string msg) override; |
| 49 | 51 |
| 50 std::string errorText(); | 52 std::string errorText(); |
| 51 | 53 |
| 52 void writeErrorCount(); | 54 void writeErrorCount(); |
| 53 | 55 |
| 54 private: | 56 private: |
| 57 void addDefinition(const Expression* lvalue, const Expression* expr, |
| 58 std::unordered_map<const Variable*, const Expression*>* d
efinitions); |
| 59 |
| 60 void addDefinitions(const BasicBlock::Node& node, |
| 61 std::unordered_map<const Variable*, const Expression*>*
definitions); |
| 62 |
| 63 void scanCFG(CFG* cfg, BlockId block, std::set<BlockId>* workList); |
| 64 |
| 65 void scanCFG(const FunctionDefinition& f); |
| 55 | 66 |
| 56 void internalConvertProgram(std::string text, | 67 void internalConvertProgram(std::string text, |
| 57 Modifiers::Flag* defaultPrecision, | 68 Modifiers::Flag* defaultPrecision, |
| 58 std::vector<std::unique_ptr<ProgramElement>>* re
sult); | 69 std::vector<std::unique_ptr<ProgramElement>>* re
sult); |
| 59 | 70 |
| 60 std::shared_ptr<SymbolTable> fTypes; | 71 std::shared_ptr<SymbolTable> fTypes; |
| 61 IRGenerator* fIRGenerator; | 72 IRGenerator* fIRGenerator; |
| 62 std::string fSkiaVertText; // FIXME store parsed version instead | 73 std::string fSkiaVertText; // FIXME store parsed version instead |
| 63 | 74 |
| 64 Context fContext; | 75 Context fContext; |
| 65 int fErrorCount; | 76 int fErrorCount; |
| 66 std::string fErrorText; | 77 std::string fErrorText; |
| 67 }; | 78 }; |
| 68 | 79 |
| 69 } // namespace | 80 } // namespace |
| 70 | 81 |
| 71 #endif | 82 #endif |
| OLD | NEW |