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

Side by Side Diff: src/sksl/ir/SkSLLayout.h

Issue 2509673002: Revert of added support for push_constant layout (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: 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
« no previous file with comments | « src/sksl/ast/SkSLASTLayout.h ('k') | src/sksl/ir/SkSLModifiers.h » ('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_LAYOUT 8 #ifndef SKSL_LAYOUT
9 #define SKSL_LAYOUT 9 #define SKSL_LAYOUT
10 10
11 namespace SkSL { 11 namespace SkSL {
12 12
13 /** 13 /**
14 * Represents a layout block appearing before a variable declaration, as in: 14 * Represents a layout block appearing before a variable declaration, as in:
15 * 15 *
16 * layout (location = 0) int x; 16 * layout (location = 0) int x;
17 */ 17 */
18 struct Layout { 18 struct Layout {
19 Layout(const ASTLayout& layout) 19 Layout(const ASTLayout& layout)
20 : fLocation(layout.fLocation) 20 : fLocation(layout.fLocation)
21 , fBinding(layout.fBinding) 21 , fBinding(layout.fBinding)
22 , fIndex(layout.fIndex) 22 , fIndex(layout.fIndex)
23 , fSet(layout.fSet) 23 , fSet(layout.fSet)
24 , fBuiltin(layout.fBuiltin) 24 , fBuiltin(layout.fBuiltin)
25 , fOriginUpperLeft(layout.fOriginUpperLeft) 25 , fOriginUpperLeft(layout.fOriginUpperLeft)
26 , fOverrideCoverage(layout.fOverrideCoverage) 26 , fOverrideCoverage(layout.fOverrideCoverage)
27 , fBlendSupportAllEquations(layout.fBlendSupportAllEquations) 27 , fBlendSupportAllEquations(layout.fBlendSupportAllEquations) {}
28 , fPushConstant(layout.fPushConstant) {}
29 28
30 Layout(int location, int binding, int index, int set, int builtin, bool orig inUpperLeft, 29 Layout(int location, int binding, int index, int set, int builtin, bool orig inUpperLeft,
31 bool overrideCoverage, bool blendSupportAllEquations, bool pushconsta nt) 30 bool overrideCoverage, bool blendSupportAllEquations)
32 : fLocation(location) 31 : fLocation(location)
33 , fBinding(binding) 32 , fBinding(binding)
34 , fIndex(index) 33 , fIndex(index)
35 , fSet(set) 34 , fSet(set)
36 , fBuiltin(builtin) 35 , fBuiltin(builtin)
37 , fOriginUpperLeft(originUpperLeft) 36 , fOriginUpperLeft(originUpperLeft)
38 , fOverrideCoverage(overrideCoverage) 37 , fOverrideCoverage(overrideCoverage)
39 , fBlendSupportAllEquations(blendSupportAllEquations) 38 , fBlendSupportAllEquations(blendSupportAllEquations) {}
40 , fPushConstant(pushconstant) {}
41
42 Layout()
43 : fLocation(-1)
44 , fBinding(-1)
45 , fIndex(-1)
46 , fSet(-1)
47 , fBuiltin(-1)
48 , fOriginUpperLeft(false)
49 , fOverrideCoverage(false)
50 , fBlendSupportAllEquations(false)
51 , fPushConstant(false) {}
52 39
53 std::string description() const { 40 std::string description() const {
54 std::string result; 41 std::string result;
55 std::string separator; 42 std::string separator;
56 if (fLocation >= 0) { 43 if (fLocation >= 0) {
57 result += separator + "location = " + to_string(fLocation); 44 result += separator + "location = " + to_string(fLocation);
58 separator = ", "; 45 separator = ", ";
59 } 46 }
60 if (fBinding >= 0) { 47 if (fBinding >= 0) {
61 result += separator + "binding = " + to_string(fBinding); 48 result += separator + "binding = " + to_string(fBinding);
(...skipping 16 matching lines...) Expand all
78 separator = ", "; 65 separator = ", ";
79 } 66 }
80 if (fOverrideCoverage) { 67 if (fOverrideCoverage) {
81 result += separator + "override_coverage"; 68 result += separator + "override_coverage";
82 separator = ", "; 69 separator = ", ";
83 } 70 }
84 if (fBlendSupportAllEquations) { 71 if (fBlendSupportAllEquations) {
85 result += separator + "blend_support_all_equations"; 72 result += separator + "blend_support_all_equations";
86 separator = ", "; 73 separator = ", ";
87 } 74 }
88 if (fPushConstant) {
89 result += separator + "push_constant";
90 separator = ", ";
91 }
92 if (result.length() > 0) { 75 if (result.length() > 0) {
93 result = "layout (" + result + ")"; 76 result = "layout (" + result + ")";
94 } 77 }
95 return result; 78 return result;
96 } 79 }
97 80
98 bool operator==(const Layout& other) const { 81 bool operator==(const Layout& other) const {
99 return fLocation == other.fLocation && 82 return fLocation == other.fLocation &&
100 fBinding == other.fBinding && 83 fBinding == other.fBinding &&
101 fIndex == other.fIndex && 84 fIndex == other.fIndex &&
102 fSet == other.fSet && 85 fSet == other.fSet &&
103 fBuiltin == other.fBuiltin && 86 fBuiltin == other.fBuiltin &&
104 fOriginUpperLeft == other.fOriginUpperLeft && 87 fOriginUpperLeft == other.fOriginUpperLeft &&
105 fOverrideCoverage == other.fOverrideCoverage && 88 fOverrideCoverage == other.fOverrideCoverage &&
106 fBlendSupportAllEquations == other.fBlendSupportAllEquations; 89 fBlendSupportAllEquations == other.fBlendSupportAllEquations;
107 } 90 }
108 91
109 bool operator!=(const Layout& other) const { 92 bool operator!=(const Layout& other) const {
110 return !(*this == other); 93 return !(*this == other);
111 } 94 }
112 95
96 // everything but builtin is in the GLSL spec; builtin comes from SPIR-V and identifies which
97 // particular builtin value this object represents.
113 int fLocation; 98 int fLocation;
114 int fBinding; 99 int fBinding;
115 int fIndex; 100 int fIndex;
116 int fSet; 101 int fSet;
117 int fBuiltin; 102 int fBuiltin;
118 int fOffset;
119 bool fOriginUpperLeft; 103 bool fOriginUpperLeft;
120 bool fOverrideCoverage; 104 bool fOverrideCoverage;
121 bool fBlendSupportAllEquations; 105 bool fBlendSupportAllEquations;
122 bool fPushConstant;
123 }; 106 };
124 107
125 } // namespace 108 } // namespace
126 109
127 #endif 110 #endif
OLDNEW
« no previous file with comments | « src/sksl/ast/SkSLASTLayout.h ('k') | src/sksl/ir/SkSLModifiers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698