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

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

Issue 2185393003: added initial GLSL support to skslc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed gn build Created 4 years, 4 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/SkSLCodeGenerator.h ('k') | src/sksl/SkSLCompiler.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_COMPILER 8 #ifndef SKSL_COMPILER
9 #define SKSL_COMPILER 9 #define SKSL_COMPILER
10 10
11 #include <vector> 11 #include <vector>
12 #include "ir/SkSLProgram.h" 12 #include "ir/SkSLProgram.h"
13 #include "ir/SkSLSymbolTable.h" 13 #include "ir/SkSLSymbolTable.h"
14 #include "SkSLContext.h" 14 #include "SkSLContext.h"
15 #include "SkSLErrorReporter.h" 15 #include "SkSLErrorReporter.h"
16 #include "SkSLGLSLCodeGenerator.h"
16 17
17 namespace SkSL { 18 namespace SkSL {
18 19
19 class IRGenerator; 20 class IRGenerator;
20 21
21 /** 22 /**
22 * Main compiler entry point. This is a traditional compiler design which first parses the .sksl 23 * Main compiler entry point. This is a traditional compiler design which first parses the .sksl
23 * file into an abstract syntax tree (a tree of ASTNodes), then performs semanti c analysis to 24 * file into an abstract syntax tree (a tree of ASTNodes), then performs semanti c analysis to
24 * produce a Program (a tree of IRNodes), then feeds the Program into a CodeGene rator to produce 25 * produce a Program (a tree of IRNodes), then feeds the Program into a CodeGene rator to produce
25 * compiled output. 26 * compiled output.
26 */ 27 */
27 class Compiler : public ErrorReporter { 28 class Compiler : public ErrorReporter {
28 public: 29 public:
29 Compiler(); 30 Compiler();
30 31
31 ~Compiler(); 32 ~Compiler();
32 33
33 std::unique_ptr<Program> convertProgram(Program::Kind kind, std::string text ); 34 std::unique_ptr<Program> convertProgram(Program::Kind kind, std::string text );
34 35
35 » bool toSPIRV(Program::Kind kind, std::string text, std::ostream& out); 36 bool toSPIRV(Program::Kind kind, const std::string& text, std::ostream& out) ;
36 » 37
37 » bool toSPIRV(Program::Kind kind, std::string text, std::string* out); 38 bool toSPIRV(Program::Kind kind, const std::string& text, std::string* out);
39
40 bool toGLSL(Program::Kind kind, const std::string& text, GLCaps caps, std::o stream& out);
41
42 bool toGLSL(Program::Kind kind, const std::string& text, GLCaps caps, std::s tring* out);
38 43
39 void error(Position position, std::string msg) override; 44 void error(Position position, std::string msg) override;
40 45
41 std::string errorText(); 46 std::string errorText();
42 47
43 void writeErrorCount(); 48 void writeErrorCount();
44 49
45 private: 50 private:
46 51
47 void internalConvertProgram(std::string text, 52 void internalConvertProgram(std::string text,
48 » » » » » » » std::vector<std::unique_ ptr<ProgramElement>>* result); 53 std::vector<std::unique_ptr<ProgramElement>>* re sult);
49 54
50 std::shared_ptr<SymbolTable> fTypes; 55 std::shared_ptr<SymbolTable> fTypes;
51 IRGenerator* fIRGenerator; 56 IRGenerator* fIRGenerator;
52 std::string fSkiaVertText; // FIXME store parsed version instead 57 std::string fSkiaVertText; // FIXME store parsed version instead
53 58
54 Context fContext; 59 Context fContext;
55 int fErrorCount; 60 int fErrorCount;
56 std::string fErrorText; 61 std::string fErrorText;
57 }; 62 };
58 63
59 } // namespace 64 } // namespace
60 65
61 #endif 66 #endif
OLDNEW
« no previous file with comments | « src/sksl/SkSLCodeGenerator.h ('k') | src/sksl/SkSLCompiler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698