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

Side by Side Diff: src/sksl/ast/SkSLASTLayout.h

Issue 2187433003: added support for push_constant layout (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: rebased Created 4 years, 1 month 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
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_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 int 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 bool overrideCoverage, bool blendSupportAllEquations, bool pushCon stant)
25 : fLocation(location) 25 : fLocation(location)
26 , fBinding(binding) 26 , fBinding(binding)
27 , fIndex(index) 27 , fIndex(index)
28 , fSet(set) 28 , fSet(set)
29 , fBuiltin(builtin) 29 , fBuiltin(builtin)
30 , fOriginUpperLeft(originUpperLeft) 30 , fOriginUpperLeft(originUpperLeft)
31 , fOverrideCoverage(overrideCoverage) 31 , fOverrideCoverage(overrideCoverage)
32 , fBlendSupportAllEquations(blendSupportAllEquations) {} 32 , fBlendSupportAllEquations(blendSupportAllEquations)
33 , fPushConstant(pushConstant) {}
33 34
34 std::string description() const { 35 std::string description() const {
35 std::string result; 36 std::string result;
36 std::string separator; 37 std::string separator;
37 if (fLocation >= 0) { 38 if (fLocation >= 0) {
38 result += separator + "location = " + to_string(fLocation); 39 result += separator + "location = " + to_string(fLocation);
39 separator = ", "; 40 separator = ", ";
40 } 41 }
41 if (fBinding >= 0) { 42 if (fBinding >= 0) {
42 result += separator + "binding = " + to_string(fBinding); 43 result += separator + "binding = " + to_string(fBinding);
(...skipping 16 matching lines...) Expand all
59 separator = ", "; 60 separator = ", ";
60 } 61 }
61 if (fOverrideCoverage) { 62 if (fOverrideCoverage) {
62 result += separator + "override_coverage"; 63 result += separator + "override_coverage";
63 separator = ", "; 64 separator = ", ";
64 } 65 }
65 if (fBlendSupportAllEquations) { 66 if (fBlendSupportAllEquations) {
66 result += separator + "blend_support_all_equations"; 67 result += separator + "blend_support_all_equations";
67 separator = ", "; 68 separator = ", ";
68 } 69 }
70 if (fPushConstant) {
71 result += separator + "push_constant";
72 separator = ", ";
73 }
69 if (result.length() > 0) { 74 if (result.length() > 0) {
70 result = "layout (" + result + ")"; 75 result = "layout (" + result + ")";
71 } 76 }
72 return result; 77 return result;
73 } 78 }
74 79
75 const int fLocation; 80 const int fLocation;
76 const int fBinding; 81 const int fBinding;
77 const int fIndex; 82 const int fIndex;
78 const int fSet; 83 const int fSet;
79 const int fBuiltin; 84 const int fBuiltin;
80 const bool fOriginUpperLeft; 85 const bool fOriginUpperLeft;
81 const bool fOverrideCoverage; 86 const bool fOverrideCoverage;
82 const bool fBlendSupportAllEquations; 87 const bool fBlendSupportAllEquations;
88 const bool fPushConstant;
83 }; 89 };
84 90
85 } // namespace 91 } // namespace
86 92
87 #endif 93 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698