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

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

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed CMake build Created 4 years, 5 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
(Empty)
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 */
7
8 #ifndef SKSL_COMPILER
9 #define SKSL_COMPILER
10
11 #include <vector>
12 #include "ir/SkSLProgram.h"
13 #include "ir/SkSLSymbolTable.h"
14 #include "SkSLErrorReporter.h"
15
16 namespace SkSL {
17
18 class IRGenerator;
19
20 /**
21 * Main compiler entry point. This is a traditional compiler design which first parses the .sksl
22 * file into an abstract syntax tree (a tree of ASTNodes), then performs semanti c analysis to
23 * produce a Program (a tree of IRNodes), then feeds the Program into a CodeGene rator to produce
24 * compiled output.
25 */
26 class Compiler : public ErrorReporter {
27 public:
28 Compiler();
29
30 ~Compiler();
31
32 std::unique_ptr<Program> convertProgram(Program::Kind kind, std::string text );
33
34 bool toSPIRV(Program::Kind kind, std::string text, std::ostream& out);
35
36 bool toSPIRV(Program::Kind kind, std::string text, std::string* out);
37
38 void error(Position position, std::string msg) override;
39
40 std::string errorText();
41
42 void writeErrorCount();
43
44 private:
45
46 void internalConvertProgram(std::string text,
47 std::vector<std::unique_ ptr<ProgramElement>>* result);
48
49 std::shared_ptr<SymbolTable> fTypes;
50 IRGenerator* fIRGenerator;
51 std::string fSkiaVertText; // FIXME store parsed version instead
52
53 int fErrorCount;
54 std::string fErrorText;
55 };
56
57 } // namespace
58
59 #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