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_PROGRAM | 8 #ifndef SKSL_PROGRAM |
9 #define SKSL_PROGRAM | 9 #define SKSL_PROGRAM |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
| 14 #include "SkSLModifiers.h" |
14 #include "SkSLProgramElement.h" | 15 #include "SkSLProgramElement.h" |
15 #include "SkSLSymbolTable.h" | 16 #include "SkSLSymbolTable.h" |
16 | 17 |
17 namespace SkSL { | 18 namespace SkSL { |
18 | 19 |
19 /** | 20 /** |
20 * Represents a fully-digested program, ready for code generation. | 21 * Represents a fully-digested program, ready for code generation. |
21 */ | 22 */ |
22 struct Program { | 23 struct Program { |
23 enum Kind { | 24 enum Kind { |
24 kFragment_Kind, | 25 kFragment_Kind, |
25 kVertex_Kind | 26 kVertex_Kind |
26 }; | 27 }; |
27 | 28 |
28 Program(Kind kind, std::vector<std::unique_ptr<ProgramElement>> elements, | 29 Program(Kind kind, |
| 30 Modifiers::Flag defaultPrecision, |
| 31 std::vector<std::unique_ptr<ProgramElement>> elements, |
29 std::shared_ptr<SymbolTable> symbols) | 32 std::shared_ptr<SymbolTable> symbols) |
30 : fKind(kind) | 33 : fKind(kind) |
| 34 , fDefaultPrecision(defaultPrecision) |
31 , fElements(std::move(elements)) | 35 , fElements(std::move(elements)) |
32 , fSymbols(symbols) {} | 36 , fSymbols(symbols) {} |
33 | 37 |
34 Kind fKind; | 38 Kind fKind; |
35 | 39 // FIXME handle different types; currently it assumes this is for floats |
| 40 Modifiers::Flag fDefaultPrecision; |
36 std::vector<std::unique_ptr<ProgramElement>> fElements; | 41 std::vector<std::unique_ptr<ProgramElement>> fElements; |
37 std::shared_ptr<SymbolTable> fSymbols; | 42 std::shared_ptr<SymbolTable> fSymbols; |
38 }; | 43 }; |
39 | 44 |
40 } // namespace | 45 } // namespace |
41 | 46 |
42 #endif | 47 #endif |
OLD | NEW |