ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
Ethan Nicholas | 11d5397 | 2016-11-28 11:23:23 -0500 | [diff] [blame] | 7 | |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 8 | #ifndef SKSL_IRGENERATOR |
| 9 | #define SKSL_IRGENERATOR |
| 10 | |
John Stiles | ddefaee | 2020-08-11 15:13:26 -0400 | [diff] [blame] | 11 | #include <unordered_map> |
John Stiles | b8e010c | 2020-08-11 18:05:39 -0400 | [diff] [blame] | 12 | #include <unordered_set> |
Ethan Nicholas | db80f69 | 2019-11-22 14:06:12 -0500 | [diff] [blame] | 13 | |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 14 | #include "src/sksl/SkSLASTFile.h" |
| 15 | #include "src/sksl/SkSLASTNode.h" |
Mike Klein | 4b432fa | 2019-06-06 11:44:05 -0500 | [diff] [blame] | 16 | #include "src/sksl/SkSLErrorReporter.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 17 | #include "src/sksl/ir/SkSLBlock.h" |
| 18 | #include "src/sksl/ir/SkSLExpression.h" |
| 19 | #include "src/sksl/ir/SkSLExtension.h" |
| 20 | #include "src/sksl/ir/SkSLFunctionDefinition.h" |
| 21 | #include "src/sksl/ir/SkSLInterfaceBlock.h" |
| 22 | #include "src/sksl/ir/SkSLModifiers.h" |
| 23 | #include "src/sksl/ir/SkSLModifiersDeclaration.h" |
| 24 | #include "src/sksl/ir/SkSLProgram.h" |
| 25 | #include "src/sksl/ir/SkSLSection.h" |
| 26 | #include "src/sksl/ir/SkSLStatement.h" |
| 27 | #include "src/sksl/ir/SkSLSymbolTable.h" |
| 28 | #include "src/sksl/ir/SkSLType.h" |
| 29 | #include "src/sksl/ir/SkSLTypeReference.h" |
| 30 | #include "src/sksl/ir/SkSLVarDeclarations.h" |
| 31 | #include "src/sksl/ir/SkSLVariableReference.h" |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 32 | |
| 33 | namespace SkSL { |
| 34 | |
John Stiles | 2d4f959 | 2020-10-30 10:29:12 -0400 | [diff] [blame] | 35 | class ExternalValue; |
Ethan Nicholas | 1e9f7f3 | 2020-10-08 05:28:32 -0400 | [diff] [blame] | 36 | class FunctionCall; |
John Stiles | dc75a97 | 2020-11-25 16:24:55 -0500 | [diff] [blame] | 37 | class StructDefinition; |
Brian Osman | 3d87e9f | 2020-10-08 11:50:22 -0400 | [diff] [blame] | 38 | struct ParsedModule; |
Ethan Nicholas | cb0f409 | 2019-04-19 11:26:50 -0400 | [diff] [blame] | 39 | struct Swizzle; |
| 40 | |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 41 | /** |
John Stiles | 810c8cf | 2020-08-26 19:46:27 -0400 | [diff] [blame] | 42 | * Intrinsics are passed between the Compiler and the IRGenerator using IRIntrinsicMaps. |
| 43 | */ |
Brian Osman | 2b469eb | 2020-09-21 11:32:10 -0400 | [diff] [blame] | 44 | class IRIntrinsicMap { |
| 45 | public: |
| 46 | IRIntrinsicMap(IRIntrinsicMap* parent) : fParent(parent) {} |
| 47 | |
| 48 | void insertOrDie(String key, std::unique_ptr<ProgramElement> element) { |
| 49 | SkASSERT(fIntrinsics.find(key) == fIntrinsics.end()); |
| 50 | fIntrinsics[key] = Intrinsic{std::move(element), false}; |
| 51 | } |
| 52 | |
Brian Osman | afa18ee | 2020-10-07 17:47:45 -0400 | [diff] [blame] | 53 | const ProgramElement* find(const String& key) { |
| 54 | auto iter = fIntrinsics.find(key); |
| 55 | if (iter == fIntrinsics.end()) { |
| 56 | return fParent ? fParent->find(key) : nullptr; |
| 57 | } |
| 58 | return iter->second.fIntrinsic.get(); |
| 59 | } |
| 60 | |
Brian Osman | 2b469eb | 2020-09-21 11:32:10 -0400 | [diff] [blame] | 61 | // Only returns an intrinsic that isn't already marked as included, and then marks it. |
Brian Osman | 00a8b5b | 2020-10-02 09:06:04 -0400 | [diff] [blame] | 62 | const ProgramElement* findAndInclude(const String& key) { |
Brian Osman | 2b469eb | 2020-09-21 11:32:10 -0400 | [diff] [blame] | 63 | auto iter = fIntrinsics.find(key); |
| 64 | if (iter == fIntrinsics.end()) { |
| 65 | return fParent ? fParent->findAndInclude(key) : nullptr; |
| 66 | } |
| 67 | if (iter->second.fAlreadyIncluded) { |
| 68 | return nullptr; |
| 69 | } |
| 70 | iter->second.fAlreadyIncluded = true; |
| 71 | return iter->second.fIntrinsic.get(); |
| 72 | } |
| 73 | |
| 74 | void resetAlreadyIncluded() { |
| 75 | for (auto& pair : fIntrinsics) { |
| 76 | pair.second.fAlreadyIncluded = false; |
| 77 | } |
| 78 | if (fParent) { |
| 79 | fParent->resetAlreadyIncluded(); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | private: |
| 84 | struct Intrinsic { |
| 85 | std::unique_ptr<ProgramElement> fIntrinsic; |
| 86 | bool fAlreadyIncluded = false; |
| 87 | }; |
| 88 | |
| 89 | std::unordered_map<String, Intrinsic> fIntrinsics; |
| 90 | IRIntrinsicMap* fParent = nullptr; |
John Stiles | 810c8cf | 2020-08-26 19:46:27 -0400 | [diff] [blame] | 91 | }; |
John Stiles | 810c8cf | 2020-08-26 19:46:27 -0400 | [diff] [blame] | 92 | |
| 93 | /** |
Ethan Nicholas | 11d5397 | 2016-11-28 11:23:23 -0500 | [diff] [blame] | 94 | * Performs semantic analysis on an abstract syntax tree (AST) and produces the corresponding |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 95 | * (unoptimized) intermediate representation (IR). |
| 96 | */ |
| 97 | class IRGenerator { |
| 98 | public: |
Brian Osman | 0006ad0 | 2020-11-18 15:38:39 -0500 | [diff] [blame] | 99 | IRGenerator(const Context* context, |
| 100 | const ShaderCapsClass* caps, |
Brian Osman | 0006ad0 | 2020-11-18 15:38:39 -0500 | [diff] [blame] | 101 | ErrorReporter& errorReporter); |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 102 | |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 103 | struct IRBundle { |
| 104 | std::vector<std::unique_ptr<ProgramElement>> fElements; |
Brian Osman | 133724c | 2020-10-28 14:14:39 -0400 | [diff] [blame] | 105 | std::vector<const ProgramElement*> fSharedElements; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 106 | std::unique_ptr<ModifiersPool> fModifiers; |
| 107 | std::shared_ptr<SymbolTable> fSymbolTable; |
| 108 | Program::Inputs fInputs; |
| 109 | }; |
| 110 | |
| 111 | /** |
| 112 | * If externalValues is supplied, those values are registered in the symbol table of the |
| 113 | * Program, but ownership is *not* transferred. It is up to the caller to keep them alive. |
| 114 | */ |
| 115 | IRBundle convertProgram(Program::Kind kind, |
| 116 | const Program::Settings* settings, |
| 117 | const ParsedModule& base, |
| 118 | bool isBuiltinCode, |
| 119 | const char* text, |
| 120 | size_t length, |
| 121 | const std::vector<std::unique_ptr<ExternalValue>>* externalValues); |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 122 | |
Ethan Nicholas | 86a4340 | 2017-01-19 13:32:00 -0500 | [diff] [blame] | 123 | /** |
| 124 | * If both operands are compile-time constants and can be folded, returns an expression |
| 125 | * representing the folded value. Otherwise, returns null. Note that unlike most other functions |
| 126 | * here, null does not represent a compilation error. |
| 127 | */ |
| 128 | std::unique_ptr<Expression> constantFold(const Expression& left, |
| 129 | Token::Kind op, |
| 130 | const Expression& right) const; |
Ethan Nicholas | 0054311 | 2018-07-31 09:44:36 -0400 | [diff] [blame] | 131 | |
Ethan Nicholas | 01ec7e8 | 2020-10-08 12:10:12 -0400 | [diff] [blame] | 132 | // both of these functions return null and report an error if the setting does not exist |
| 133 | const Type* typeForSetting(int offset, String name) const; |
| 134 | std::unique_ptr<Expression> valueForSetting(int offset, String name) const; |
| 135 | |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 136 | const Program::Settings* settings() const { return fSettings; } |
| 137 | |
Ethan Nicholas | ba9a04f | 2020-11-06 09:28:04 -0500 | [diff] [blame] | 138 | std::shared_ptr<SymbolTable>& symbolTable() { |
| 139 | return fSymbolTable; |
| 140 | } |
| 141 | |
| 142 | void setSymbolTable(std::shared_ptr<SymbolTable>& symbolTable) { |
| 143 | fSymbolTable = symbolTable; |
| 144 | } |
| 145 | |
| 146 | void pushSymbolTable(); |
| 147 | void popSymbolTable(); |
| 148 | |
Ethan Nicholas | 86a4340 | 2017-01-19 13:32:00 -0500 | [diff] [blame] | 149 | const Context& fContext; |
Ethan Nicholas | 941e7e2 | 2016-12-12 15:33:30 -0500 | [diff] [blame] | 150 | |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 151 | private: |
Ethan Nicholas | 3605ace | 2016-11-21 15:59:48 -0500 | [diff] [blame] | 152 | /** |
Ethan Nicholas | 041fd0a | 2020-10-07 16:42:04 -0400 | [diff] [blame] | 153 | * Relinquishes ownership of the Modifiers that have been collected so far and returns them. |
| 154 | */ |
| 155 | std::unique_ptr<ModifiersPool> releaseModifiers(); |
| 156 | |
Ethan Nicholas | 63d7ee3 | 2020-08-17 10:57:12 -0400 | [diff] [blame] | 157 | void checkModifiers(int offset, const Modifiers& modifiers, int permitted); |
John Stiles | 8f2a0cf | 2020-10-13 12:48:21 -0400 | [diff] [blame] | 158 | StatementArray convertVarDeclarations(const ASTNode& decl, Variable::Storage storage); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 159 | void convertFunction(const ASTNode& f); |
Ethan Nicholas | 70728ef | 2020-05-28 07:09:00 -0400 | [diff] [blame] | 160 | std::unique_ptr<Statement> convertSingleStatement(const ASTNode& statement); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 161 | std::unique_ptr<Statement> convertStatement(const ASTNode& statement); |
| 162 | std::unique_ptr<Expression> convertExpression(const ASTNode& expression); |
| 163 | std::unique_ptr<ModifiersDeclaration> convertModifiersDeclaration(const ASTNode& m); |
Ethan Nicholas | 7da6dfa | 2017-06-21 11:25:18 -0400 | [diff] [blame] | 164 | |
Brian Osman | d807039 | 2020-09-09 15:50:02 -0400 | [diff] [blame] | 165 | const Type* convertType(const ASTNode& type, bool allowVoid = false); |
Ethan Nicholas | 5b5f096 | 2017-09-11 13:50:14 -0700 | [diff] [blame] | 166 | std::unique_ptr<Expression> call(int offset, |
Ethan Nicholas | 11d5397 | 2016-11-28 11:23:23 -0500 | [diff] [blame] | 167 | const FunctionDeclaration& function, |
John Stiles | 8e3b6be | 2020-10-13 11:14:08 -0400 | [diff] [blame] | 168 | ExpressionArray arguments); |
Brian Osman | 0acb5b5 | 2020-09-02 13:45:47 -0400 | [diff] [blame] | 169 | CoercionCost callCost(const FunctionDeclaration& function, |
John Stiles | 8e3b6be | 2020-10-13 11:14:08 -0400 | [diff] [blame] | 170 | const ExpressionArray& arguments); |
| 171 | std::unique_ptr<Expression> call(int offset, |
| 172 | std::unique_ptr<Expression> function, |
| 173 | ExpressionArray arguments); |
Brian Osman | 0acb5b5 | 2020-09-02 13:45:47 -0400 | [diff] [blame] | 174 | CoercionCost coercionCost(const Expression& expr, const Type& type); |
ethannicholas | d598f79 | 2016-07-25 10:08:54 -0700 | [diff] [blame] | 175 | std::unique_ptr<Expression> coerce(std::unique_ptr<Expression> expr, const Type& type); |
John Stiles | cf27b4f | 2020-11-06 11:37:05 -0500 | [diff] [blame] | 176 | template <typename T> |
| 177 | std::unique_ptr<Expression> constantFoldVector(const Expression& left, |
| 178 | Token::Kind op, |
| 179 | const Expression& right) const; |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 180 | std::unique_ptr<Block> convertBlock(const ASTNode& block); |
| 181 | std::unique_ptr<Statement> convertBreak(const ASTNode& b); |
John Stiles | 8e3b6be | 2020-10-13 11:14:08 -0400 | [diff] [blame] | 182 | std::unique_ptr<Expression> convertNumberConstructor(int offset, |
| 183 | const Type& type, |
| 184 | ExpressionArray params); |
| 185 | std::unique_ptr<Expression> convertCompoundConstructor(int offset, |
| 186 | const Type& type, |
| 187 | ExpressionArray params); |
Ethan Nicholas | 5b5f096 | 2017-09-11 13:50:14 -0700 | [diff] [blame] | 188 | std::unique_ptr<Expression> convertConstructor(int offset, |
Ethan Nicholas | 11d5397 | 2016-11-28 11:23:23 -0500 | [diff] [blame] | 189 | const Type& type, |
John Stiles | 8e3b6be | 2020-10-13 11:14:08 -0400 | [diff] [blame] | 190 | ExpressionArray params); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 191 | std::unique_ptr<Statement> convertContinue(const ASTNode& c); |
| 192 | std::unique_ptr<Statement> convertDiscard(const ASTNode& d); |
| 193 | std::unique_ptr<Statement> convertDo(const ASTNode& d); |
| 194 | std::unique_ptr<Statement> convertSwitch(const ASTNode& s); |
| 195 | std::unique_ptr<Expression> convertBinaryExpression(const ASTNode& expression); |
| 196 | std::unique_ptr<Extension> convertExtension(int offset, StringFragment name); |
| 197 | std::unique_ptr<Statement> convertExpressionStatement(const ASTNode& s); |
| 198 | std::unique_ptr<Statement> convertFor(const ASTNode& f); |
| 199 | std::unique_ptr<Expression> convertIdentifier(const ASTNode& identifier); |
| 200 | std::unique_ptr<Statement> convertIf(const ASTNode& s); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 201 | std::unique_ptr<InterfaceBlock> convertInterfaceBlock(const ASTNode& s); |
Ethan Nicholas | 11d5397 | 2016-11-28 11:23:23 -0500 | [diff] [blame] | 202 | Modifiers convertModifiers(const Modifiers& m); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 203 | std::unique_ptr<Expression> convertPrefixExpression(const ASTNode& expression); |
| 204 | std::unique_ptr<Statement> convertReturn(const ASTNode& r); |
| 205 | std::unique_ptr<Section> convertSection(const ASTNode& e); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 206 | std::unique_ptr<Expression> convertCallExpression(const ASTNode& expression); |
| 207 | std::unique_ptr<Expression> convertFieldExpression(const ASTNode& expression); |
| 208 | std::unique_ptr<Expression> convertIndexExpression(const ASTNode& expression); |
John Stiles | 1b27c3d | 2020-12-07 12:14:55 -0500 | [diff] [blame^] | 209 | std::unique_ptr<Expression> convertIndex(std::unique_ptr<Expression> base, |
| 210 | const ASTNode& index); |
| 211 | std::unique_ptr<Expression> convertEmptyIndex(std::unique_ptr<Expression> base); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 212 | std::unique_ptr<Expression> convertPostfixExpression(const ASTNode& expression); |
Brian Osman | 6518d77 | 2020-09-10 16:50:06 -0400 | [diff] [blame] | 213 | std::unique_ptr<Expression> convertScopeExpression(const ASTNode& expression); |
John Stiles | dc75a97 | 2020-11-25 16:24:55 -0500 | [diff] [blame] | 214 | std::unique_ptr<StructDefinition> convertStructDefinition(const ASTNode& expression); |
Ethan Nicholas | aae47c8 | 2017-11-10 15:34:03 -0500 | [diff] [blame] | 215 | std::unique_ptr<Expression> convertTypeField(int offset, const Type& type, |
| 216 | StringFragment field); |
Ethan Nicholas | 11d5397 | 2016-11-28 11:23:23 -0500 | [diff] [blame] | 217 | std::unique_ptr<Expression> convertField(std::unique_ptr<Expression> base, |
Ethan Nicholas | 5b5f096 | 2017-09-11 13:50:14 -0700 | [diff] [blame] | 218 | StringFragment field); |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 219 | std::unique_ptr<Expression> convertSwizzle(std::unique_ptr<Expression> base, |
Ethan Nicholas | 5b5f096 | 2017-09-11 13:50:14 -0700 | [diff] [blame] | 220 | StringFragment fields); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 221 | std::unique_ptr<Expression> convertTernaryExpression(const ASTNode& expression); |
| 222 | std::unique_ptr<Statement> convertVarDeclarationStatement(const ASTNode& s); |
| 223 | std::unique_ptr<Statement> convertWhile(const ASTNode& w); |
John Stiles | 7bd7033 | 2020-11-30 17:04:09 -0500 | [diff] [blame] | 224 | void convertGlobalVarDeclarations(const ASTNode& decl); |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 225 | void convertEnum(const ASTNode& e); |
Ethan Nicholas | aae47c8 | 2017-11-10 15:34:03 -0500 | [diff] [blame] | 226 | std::unique_ptr<Block> applyInvocationIDWorkaround(std::unique_ptr<Block> main); |
Robert Phillips | fe8da17 | 2018-01-24 14:52:02 +0000 | [diff] [blame] | 227 | // returns a statement which converts sk_Position from device to normalized coordinates |
| 228 | std::unique_ptr<Statement> getNormalizeSkPositionCode(); |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 229 | |
| 230 | void checkValid(const Expression& expr); |
John Stiles | b4b627e | 2020-11-13 15:55:27 -0500 | [diff] [blame] | 231 | bool typeContainsPrivateFields(const Type& type); |
John Stiles | 403a363 | 2020-08-20 12:11:48 -0400 | [diff] [blame] | 232 | bool setRefKind(Expression& expr, VariableReference::RefKind kind); |
Brian Osman | 3e3db6c | 2020-08-14 09:42:12 -0400 | [diff] [blame] | 233 | bool getConstantInt(const Expression& value, int64_t* out); |
Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 234 | void copyIntrinsicIfNeeded(const FunctionDeclaration& function); |
Brian Osman | 9496fe5 | 2020-11-18 14:48:19 -0500 | [diff] [blame] | 235 | void findAndDeclareBuiltinVariables(); |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 236 | |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 237 | Program::Inputs fInputs; |
| 238 | const Program::Settings* fSettings = nullptr; |
Brian Osman | d7e7659 | 2020-11-02 12:26:22 -0500 | [diff] [blame] | 239 | const ShaderCapsClass* fCaps = nullptr; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 240 | Program::Kind fKind; |
| 241 | |
Ethan Nicholas | fc99416 | 2019-06-06 10:04:27 -0400 | [diff] [blame] | 242 | std::unique_ptr<ASTFile> fFile; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 243 | const FunctionDeclaration* fCurrentFunction = nullptr; |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 244 | std::unordered_map<String, Program::Settings::Value> fCapsMap; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 245 | std::shared_ptr<SymbolTable> fSymbolTable = nullptr; |
Ethan Nicholas | 70728ef | 2020-05-28 07:09:00 -0400 | [diff] [blame] | 246 | // additional statements that need to be inserted before the one that convertStatement is |
| 247 | // currently working on |
John Stiles | 8f2a0cf | 2020-10-13 12:48:21 -0400 | [diff] [blame] | 248 | StatementArray fExtraStatements; |
John Stiles | 810c8cf | 2020-08-26 19:46:27 -0400 | [diff] [blame] | 249 | // Symbols which have definitions in the include files. |
| 250 | IRIntrinsicMap* fIntrinsics = nullptr; |
John Stiles | b8e010c | 2020-08-11 18:05:39 -0400 | [diff] [blame] | 251 | std::unordered_set<const FunctionDeclaration*> fReferencedIntrinsics; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 252 | int fLoopLevel = 0; |
| 253 | int fSwitchLevel = 0; |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 254 | ErrorReporter& fErrors; |
Ethan Nicholas | 7da6dfa | 2017-06-21 11:25:18 -0400 | [diff] [blame] | 255 | int fInvocations; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 256 | std::vector<std::unique_ptr<ProgramElement>>* fProgramElements = nullptr; |
Brian Osman | 133724c | 2020-10-28 14:14:39 -0400 | [diff] [blame] | 257 | std::vector<const ProgramElement*>* fSharedElements = nullptr; |
Brian Osman | 88cda17 | 2020-10-09 12:05:16 -0400 | [diff] [blame] | 258 | const Variable* fRTAdjust = nullptr; |
| 259 | const Variable* fRTAdjustInterfaceBlock = nullptr; |
Robert Phillips | fe8da17 | 2018-01-24 14:52:02 +0000 | [diff] [blame] | 260 | int fRTAdjustFieldIndex; |
John Stiles | 881a10c | 2020-09-19 10:13:24 -0400 | [diff] [blame] | 261 | bool fCanInline = true; |
Ethan Nicholas | c18bb51 | 2020-07-28 14:46:53 -0400 | [diff] [blame] | 262 | // true if we are currently processing one of the built-in SkSL include files |
Ethan Nicholas | ba9a04f | 2020-11-06 09:28:04 -0500 | [diff] [blame] | 263 | bool fIsBuiltinCode = false; |
Ethan Nicholas | 041fd0a | 2020-10-07 16:42:04 -0400 | [diff] [blame] | 264 | std::unique_ptr<ModifiersPool> fModifiers; |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 265 | |
| 266 | friend class AutoSymbolTable; |
ethannicholas | 22f939e | 2016-10-13 13:25:34 -0700 | [diff] [blame] | 267 | friend class AutoLoopLevel; |
Ethan Nicholas | af19769 | 2017-02-27 13:26:45 -0500 | [diff] [blame] | 268 | friend class AutoSwitchLevel; |
John Stiles | d1c4dac | 2020-08-11 18:50:50 -0400 | [diff] [blame] | 269 | friend class AutoDisableInline; |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 270 | friend class Compiler; |
| 271 | }; |
| 272 | |
John Stiles | a6841be | 2020-08-06 14:11:56 -0400 | [diff] [blame] | 273 | } // namespace SkSL |
ethannicholas | b3058bd | 2016-07-01 08:22:01 -0700 | [diff] [blame] | 274 | |
| 275 | #endif |