Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/sksl/SkSLIRGenerator.h

Issue 2288033003: Turned on SkSL->GLSL compiler (Closed)
Patch Set: changed <iostream> to <ostream> Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/sksl/SkSLGLSLCodeGenerator.cpp ('k') | src/sksl/SkSLIRGenerator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_IRGENERATOR 8 #ifndef SKSL_IRGENERATOR
9 #define SKSL_IRGENERATOR 9 #define SKSL_IRGENERATOR
10 10
11 #include "SkSLErrorReporter.h" 11 #include "SkSLErrorReporter.h"
12 #include "ast/SkSLASTBinaryExpression.h" 12 #include "ast/SkSLASTBinaryExpression.h"
13 #include "ast/SkSLASTBlock.h" 13 #include "ast/SkSLASTBlock.h"
14 #include "ast/SkSLASTBreakStatement.h" 14 #include "ast/SkSLASTBreakStatement.h"
15 #include "ast/SkSLASTCallSuffix.h" 15 #include "ast/SkSLASTCallSuffix.h"
16 #include "ast/SkSLASTContinueStatement.h" 16 #include "ast/SkSLASTContinueStatement.h"
17 #include "ast/SkSLASTDiscardStatement.h" 17 #include "ast/SkSLASTDiscardStatement.h"
18 #include "ast/SkSLASTDoStatement.h" 18 #include "ast/SkSLASTDoStatement.h"
19 #include "ast/SkSLASTExpression.h" 19 #include "ast/SkSLASTExpression.h"
20 #include "ast/SkSLASTExpressionStatement.h" 20 #include "ast/SkSLASTExpressionStatement.h"
21 #include "ast/SkSLASTExtension.h" 21 #include "ast/SkSLASTExtension.h"
22 #include "ast/SkSLASTForStatement.h" 22 #include "ast/SkSLASTForStatement.h"
23 #include "ast/SkSLASTFunction.h" 23 #include "ast/SkSLASTFunction.h"
24 #include "ast/SkSLASTIdentifier.h" 24 #include "ast/SkSLASTIdentifier.h"
25 #include "ast/SkSLASTIfStatement.h" 25 #include "ast/SkSLASTIfStatement.h"
26 #include "ast/SkSLASTInterfaceBlock.h" 26 #include "ast/SkSLASTInterfaceBlock.h"
27 #include "ast/SkSLASTModifiers.h" 27 #include "ast/SkSLASTModifiers.h"
28 #include "ast/SkSLASTModifiersDeclaration.h"
28 #include "ast/SkSLASTPrefixExpression.h" 29 #include "ast/SkSLASTPrefixExpression.h"
29 #include "ast/SkSLASTReturnStatement.h" 30 #include "ast/SkSLASTReturnStatement.h"
30 #include "ast/SkSLASTStatement.h" 31 #include "ast/SkSLASTStatement.h"
31 #include "ast/SkSLASTSuffixExpression.h" 32 #include "ast/SkSLASTSuffixExpression.h"
32 #include "ast/SkSLASTTernaryExpression.h" 33 #include "ast/SkSLASTTernaryExpression.h"
33 #include "ast/SkSLASTVarDeclaration.h" 34 #include "ast/SkSLASTVarDeclaration.h"
34 #include "ast/SkSLASTVarDeclarationStatement.h" 35 #include "ast/SkSLASTVarDeclarationStatement.h"
35 #include "ast/SkSLASTWhileStatement.h" 36 #include "ast/SkSLASTWhileStatement.h"
36 #include "ir/SkSLBlock.h" 37 #include "ir/SkSLBlock.h"
37 #include "ir/SkSLExpression.h" 38 #include "ir/SkSLExpression.h"
38 #include "ir/SkSLExtension.h" 39 #include "ir/SkSLExtension.h"
39 #include "ir/SkSLFunctionDefinition.h" 40 #include "ir/SkSLFunctionDefinition.h"
40 #include "ir/SkSLInterfaceBlock.h" 41 #include "ir/SkSLInterfaceBlock.h"
41 #include "ir/SkSLModifiers.h" 42 #include "ir/SkSLModifiers.h"
43 #include "ir/SkSLModifiersDeclaration.h"
42 #include "ir/SkSLSymbolTable.h" 44 #include "ir/SkSLSymbolTable.h"
43 #include "ir/SkSLStatement.h" 45 #include "ir/SkSLStatement.h"
44 #include "ir/SkSLType.h" 46 #include "ir/SkSLType.h"
45 #include "ir/SkSLTypeReference.h" 47 #include "ir/SkSLTypeReference.h"
46 #include "ir/SkSLVarDeclaration.h" 48 #include "ir/SkSLVarDeclaration.h"
47 49
48 namespace SkSL { 50 namespace SkSL {
49 51
50 /** 52 /**
51 * Performs semantic analysis on an abstract syntax tree (AST) and produces the corresponding 53 * Performs semantic analysis on an abstract syntax tree (AST) and produces the corresponding
52 * (unoptimized) intermediate representation (IR). 54 * (unoptimized) intermediate representation (IR).
53 */ 55 */
54 class IRGenerator { 56 class IRGenerator {
55 public: 57 public:
56 IRGenerator(const Context* context, std::shared_ptr<SymbolTable> root, 58 IRGenerator(const Context* context, std::shared_ptr<SymbolTable> root,
57 ErrorReporter& errorReporter); 59 ErrorReporter& errorReporter);
58 60
59 std::unique_ptr<VarDeclarations> convertVarDeclarations(const ASTVarDeclarat ions& decl, 61 std::unique_ptr<VarDeclarations> convertVarDeclarations(const ASTVarDeclarat ions& decl,
60 Variable::Storage st orage); 62 Variable::Storage st orage);
61 std::unique_ptr<FunctionDefinition> convertFunction(const ASTFunction& f); 63 std::unique_ptr<FunctionDefinition> convertFunction(const ASTFunction& f);
62 std::unique_ptr<Statement> convertStatement(const ASTStatement& statement); 64 std::unique_ptr<Statement> convertStatement(const ASTStatement& statement);
63 std::unique_ptr<Expression> convertExpression(const ASTExpression& expressio n); 65 std::unique_ptr<Expression> convertExpression(const ASTExpression& expressio n);
66 std::unique_ptr<ModifiersDeclaration> convertModifiersDeclaration(
67 const ASTModif iersDeclaration& m);
64 68
65 private: 69 private:
66 void pushSymbolTable(); 70 void pushSymbolTable();
67 void popSymbolTable(); 71 void popSymbolTable();
68 72
69 const Type* convertType(const ASTType& type); 73 const Type* convertType(const ASTType& type);
70 std::unique_ptr<Expression> call(Position position, 74 std::unique_ptr<Expression> call(Position position,
71 const FunctionDeclaration& function, 75 const FunctionDeclaration& function,
72 std::vector<std::unique_ptr<Expression>> ar guments); 76 std::vector<std::unique_ptr<Expression>> ar guments);
73 bool determineCallCost(const FunctionDeclaration& function, 77 bool determineCallCost(const FunctionDeclaration& function,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 std::shared_ptr<SymbolTable> fSymbolTable; 118 std::shared_ptr<SymbolTable> fSymbolTable;
115 ErrorReporter& fErrors; 119 ErrorReporter& fErrors;
116 120
117 friend class AutoSymbolTable; 121 friend class AutoSymbolTable;
118 friend class Compiler; 122 friend class Compiler;
119 }; 123 };
120 124
121 } 125 }
122 126
123 #endif 127 #endif
OLDNEW
« no previous file with comments | « src/sksl/SkSLGLSLCodeGenerator.cpp ('k') | src/sksl/SkSLIRGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698