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

Side by Side Diff: src/gpu/glsl/GrGLSLShaderVar.h

Issue 1541903002: added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 GrGLSLShaderVar_DEFINED 8 #ifndef GrGLSLShaderVar_DEFINED
9 #define GrGLSLShaderVar_DEFINED 9 #define GrGLSLShaderVar_DEFINED
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 /** 80 /**
81 * Sets as a non-array. 81 * Sets as a non-array.
82 */ 82 */
83 void set(GrSLType type, 83 void set(GrSLType type,
84 TypeModifier typeModifier, 84 TypeModifier typeModifier,
85 const SkString& name, 85 const SkString& name,
86 GrSLPrecision precision = kDefault_GrSLPrecision, 86 GrSLPrecision precision = kDefault_GrSLPrecision,
87 Origin origin = kDefault_Origin, 87 Origin origin = kDefault_Origin,
88 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { 88 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
89 SkASSERT(kVoid_GrSLType != type); 89 SkASSERT(kVoid_GrSLType != type);
90 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type )); 90 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)) ;
91 INHERITED::set(type, name, typeModifier, precision); 91 INHERITED::set(type, name, typeModifier, precision);
92 fOrigin = origin; 92 fOrigin = origin;
93 fUseUniformFloatArrays = useUniformFloatArrays; 93 fUseUniformFloatArrays = useUniformFloatArrays;
94 } 94 }
95 95
96 /** 96 /**
97 * Sets as a non-array. 97 * Sets as a non-array.
98 */ 98 */
99 void set(GrSLType type, 99 void set(GrSLType type,
100 TypeModifier typeModifier, 100 TypeModifier typeModifier,
101 const char* name, 101 const char* name,
102 GrSLPrecision precision = kDefault_GrSLPrecision, 102 GrSLPrecision precision = kDefault_GrSLPrecision,
103 Origin origin = kDefault_Origin, 103 Origin origin = kDefault_Origin,
104 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { 104 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
105 SkASSERT(kVoid_GrSLType != type); 105 SkASSERT(kVoid_GrSLType != type);
106 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type )); 106 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)) ;
107 INHERITED::set(type, name, typeModifier, precision); 107 INHERITED::set(type, name, typeModifier, precision);
108 fOrigin = origin; 108 fOrigin = origin;
109 fUseUniformFloatArrays = useUniformFloatArrays; 109 fUseUniformFloatArrays = useUniformFloatArrays;
110 } 110 }
111 111
112 /** 112 /**
113 * Set all var options 113 * Set all var options
114 */ 114 */
115 void set(GrSLType type, 115 void set(GrSLType type,
116 TypeModifier typeModifier, 116 TypeModifier typeModifier,
117 const SkString& name, 117 const SkString& name,
118 int count, 118 int count,
119 GrSLPrecision precision = kDefault_GrSLPrecision, 119 GrSLPrecision precision = kDefault_GrSLPrecision,
120 Origin origin = kDefault_Origin, 120 Origin origin = kDefault_Origin,
121 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { 121 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
122 SkASSERT(kVoid_GrSLType != type); 122 SkASSERT(kVoid_GrSLType != type);
123 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type )); 123 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)) ;
124 INHERITED::set(type, name, typeModifier, precision, count); 124 INHERITED::set(type, name, typeModifier, precision, count);
125 fOrigin = origin; 125 fOrigin = origin;
126 fUseUniformFloatArrays = useUniformFloatArrays; 126 fUseUniformFloatArrays = useUniformFloatArrays;
127 } 127 }
128 128
129 /** 129 /**
130 * Set all var options 130 * Set all var options
131 */ 131 */
132 void set(GrSLType type, 132 void set(GrSLType type,
133 TypeModifier typeModifier, 133 TypeModifier typeModifier,
134 const char* name, 134 const char* name,
135 int count, 135 int count,
136 GrSLPrecision precision = kDefault_GrSLPrecision, 136 GrSLPrecision precision = kDefault_GrSLPrecision,
137 Origin origin = kDefault_Origin, 137 Origin origin = kDefault_Origin,
138 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { 138 bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
139 SkASSERT(kVoid_GrSLType != type); 139 SkASSERT(kVoid_GrSLType != type);
140 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type )); 140 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)) ;
141 INHERITED::set(type, name, typeModifier, precision, count); 141 INHERITED::set(type, name, typeModifier, precision, count);
142 fOrigin = origin; 142 fOrigin = origin;
143 fUseUniformFloatArrays = useUniformFloatArrays; 143 fUseUniformFloatArrays = useUniformFloatArrays;
144 } 144 }
145 145
146 /** 146 /**
147 * Get the origin of the var 147 * Get the origin of the var
148 */ 148 */
149 Origin getOrigin() const { return fOrigin; } 149 Origin getOrigin() const { return fOrigin; }
150 150
151 /** 151 /**
152 * Set the origin of the var 152 * Set the origin of the var
153 */ 153 */
154 void setOrigin(Origin origin) { fOrigin = origin; } 154 void setOrigin(Origin origin) { fOrigin = origin; }
155 155
156 /** 156 /**
157 * Write a declaration of this variable to out. 157 * Write a declaration of this variable to out.
158 */ 158 */
159 void appendDecl(const GrGLSLCaps* glslCaps, SkString* out) const { 159 void appendDecl(const GrGLSLCaps* glslCaps, SkString* out) const {
160 SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeIsFloatType(fTy pe)); 160 SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeIsNumeric(fType ));
161 if (kUpperLeft_Origin == fOrigin) { 161 if (kUpperLeft_Origin == fOrigin) {
162 // this is the only place where we specify a layout modifier. If we use other layout 162 // this is the only place where we specify a layout modifier. If we use other layout
163 // modifiers in the future then they should be placed in a list. 163 // modifiers in the future then they should be placed in a list.
164 out->append("layout(origin_upper_left) "); 164 out->append("layout(origin_upper_left) ");
165 } 165 }
166 if (this->getTypeModifier() != kNone_TypeModifier) { 166 if (this->getTypeModifier() != kNone_TypeModifier) {
167 out->append(TypeModifierString(glslCaps, this->getTypeModifier())); 167 if (fType == kInt_GrSLType && (this->getTypeModifier() == kVaryingIn _TypeModifier ||
bsalomon 2016/01/13 19:15:34 Maybe create a GrSLTypeIsInt() so that we'd don't
168 out->append(" "); 168 this->getTypeModifier() == kVaryingOu t_TypeModifier)) {
169 out->append("flat ");
170 }
171 out->append(TypeModifierString(glslCaps, this->getTypeModifier()));
172 out->append(" ");
169 } 173 }
170 out->append(PrecisionString(glslCaps, fPrecision));
171 GrSLType effectiveType = this->getType(); 174 GrSLType effectiveType = this->getType();
175 if (effectiveType != kBool_GrSLType) {
176 out->append(PrecisionString(glslCaps, fPrecision));
177 }
172 if (this->isArray()) { 178 if (this->isArray()) {
173 if (this->isUnsizedArray()) { 179 if (this->isUnsizedArray()) {
174 out->appendf("%s %s[]", 180 out->appendf("%s %s[]",
175 GrGLSLTypeString(effectiveType), 181 GrGLSLTypeString(effectiveType),
176 this->getName().c_str()); 182 this->getName().c_str());
177 } else { 183 } else {
178 SkASSERT(this->getArrayCount() > 0); 184 SkASSERT(this->getArrayCount() > 0);
179 out->appendf("%s %s[%d]", 185 out->appendf("%s %s[%d]",
180 GrGLSLTypeString(effectiveType), 186 GrGLSLTypeString(effectiveType),
181 this->getName().c_str(), 187 this->getName().c_str(),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 253
248 Origin fOrigin; 254 Origin fOrigin;
249 /// Work around driver bugs on some hardware that don't correctly 255 /// Work around driver bugs on some hardware that don't correctly
250 /// support uniform float [] 256 /// support uniform float []
251 bool fUseUniformFloatArrays; 257 bool fUseUniformFloatArrays;
252 258
253 typedef GrShaderVar INHERITED; 259 typedef GrShaderVar INHERITED;
254 }; 260 };
255 261
256 #endif 262 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698