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_ASTLAYOUT | 8 #ifndef SKSL_ASTLAYOUT |
9 #define SKSL_ASTLAYOUT | 9 #define SKSL_ASTLAYOUT |
10 | 10 |
11 #include "SkSLASTNode.h" | 11 #include "SkSLASTNode.h" |
12 #include "SkSLUtil.h" | 12 #include "SkSLUtil.h" |
13 | 13 |
14 namespace SkSL { | 14 namespace SkSL { |
15 | 15 |
16 /** | 16 /** |
17 * Represents a layout block appearing before a variable declaration, as in: | 17 * Represents a layout block appearing before a variable declaration, as in: |
18 * | 18 * |
19 * layout (location = 0) int x; | 19 * layout (location = 0) int x; |
20 */ | 20 */ |
21 struct ASTLayout : public ASTNode { | 21 struct ASTLayout : public ASTNode { |
22 // For all parameters, a -1 means no value | 22 // For all parameters, a -1 means no value |
23 ASTLayout(int location, int binding, int index, int set, int builtin, bool o
riginUpperLeft) | 23 ASTLayout(int location, int binding, int index, int set, int builtin, bool o
riginUpperLeft, |
| 24 bool overrideCoverage, bool blendSupportAllEquations) |
24 : fLocation(location) | 25 : fLocation(location) |
25 , fBinding(binding) | 26 , fBinding(binding) |
26 , fIndex(index) | 27 , fIndex(index) |
27 , fSet(set) | 28 , fSet(set) |
28 , fBuiltin(builtin) | 29 , fBuiltin(builtin) |
29 , fOriginUpperLeft(originUpperLeft) {} | 30 , fOriginUpperLeft(originUpperLeft) |
| 31 , fOverrideCoverage(overrideCoverage) |
| 32 , fBlendSupportAllEquations(blendSupportAllEquations) {} |
30 | 33 |
31 std::string description() const { | 34 std::string description() const { |
32 std::string result; | 35 std::string result; |
33 std::string separator; | 36 std::string separator; |
34 if (fLocation >= 0) { | 37 if (fLocation >= 0) { |
35 result += separator + "location = " + to_string(fLocation); | 38 result += separator + "location = " + to_string(fLocation); |
36 separator = ", "; | 39 separator = ", "; |
37 } | 40 } |
38 if (fBinding >= 0) { | 41 if (fBinding >= 0) { |
39 result += separator + "binding = " + to_string(fBinding); | 42 result += separator + "binding = " + to_string(fBinding); |
40 separator = ", "; | 43 separator = ", "; |
41 } | 44 } |
42 if (fIndex >= 0) { | 45 if (fIndex >= 0) { |
43 result += separator + "index = " + to_string(fIndex); | 46 result += separator + "index = " + to_string(fIndex); |
44 separator = ", "; | 47 separator = ", "; |
45 } | 48 } |
46 if (fSet >= 0) { | 49 if (fSet >= 0) { |
47 result += separator + "set = " + to_string(fSet); | 50 result += separator + "set = " + to_string(fSet); |
48 separator = ", "; | 51 separator = ", "; |
49 } | 52 } |
50 if (fBuiltin >= 0) { | 53 if (fBuiltin >= 0) { |
51 result += separator + "builtin = " + to_string(fBuiltin); | 54 result += separator + "builtin = " + to_string(fBuiltin); |
52 separator = ", "; | 55 separator = ", "; |
53 } | 56 } |
54 if (fOriginUpperLeft) { | 57 if (fOriginUpperLeft) { |
55 result += separator + "origin_upper_left"; | 58 result += separator + "origin_upper_left"; |
56 separator = ", "; | 59 separator = ", "; |
57 } | 60 } |
| 61 if (fOverrideCoverage) { |
| 62 result += separator + "override_coverage"; |
| 63 separator = ", "; |
| 64 } |
| 65 if (fBlendSupportAllEquations) { |
| 66 result += separator + "blend_support_all_equations"; |
| 67 separator = ", "; |
| 68 } |
58 if (result.length() > 0) { | 69 if (result.length() > 0) { |
59 result = "layout (" + result + ")"; | 70 result = "layout (" + result + ")"; |
60 } | 71 } |
61 return result; | 72 return result; |
62 } | 73 } |
63 | 74 |
64 const int fLocation; | 75 const int fLocation; |
65 const int fBinding; | 76 const int fBinding; |
66 const int fIndex; | 77 const int fIndex; |
67 const int fSet; | 78 const int fSet; |
68 const int fBuiltin; | 79 const int fBuiltin; |
69 const bool fOriginUpperLeft; | 80 const bool fOriginUpperLeft; |
| 81 const bool fOverrideCoverage; |
| 82 const bool fBlendSupportAllEquations; |
70 }; | 83 }; |
71 | 84 |
72 } // namespace | 85 } // namespace |
73 | 86 |
74 #endif | 87 #endif |
OLD | NEW |