OLD | NEW |
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 GrGLShaderVar_DEFINED | 8 #ifndef GrGLShaderVar_DEFINED |
9 #define GrGLShaderVar_DEFINED | 9 #define GrGLShaderVar_DEFINED |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 if (kUpperLeft_Origin == fOrigin) { | 260 if (kUpperLeft_Origin == fOrigin) { |
261 // this is the only place where we specify a layout modifier. If we
use other layout | 261 // this is the only place where we specify a layout modifier. If we
use other layout |
262 // modifiers in the future then they should be placed in a list. | 262 // modifiers in the future then they should be placed in a list. |
263 out->append("layout(origin_upper_left) "); | 263 out->append("layout(origin_upper_left) "); |
264 } | 264 } |
265 if (this->getTypeModifier() != kNone_TypeModifier) { | 265 if (this->getTypeModifier() != kNone_TypeModifier) { |
266 out->append(TypeModifierString(this->getTypeModifier(), | 266 out->append(TypeModifierString(this->getTypeModifier(), |
267 ctxInfo.glslGeneration())); | 267 ctxInfo.glslGeneration())); |
268 out->append(" "); | 268 out->append(" "); |
269 } | 269 } |
270 out->append(PrecisionString(fPrecision, ctxInfo.binding())); | 270 out->append(PrecisionString(fPrecision, ctxInfo.standard())); |
271 GrSLType effectiveType = this->getType(); | 271 GrSLType effectiveType = this->getType(); |
272 if (this->isArray()) { | 272 if (this->isArray()) { |
273 if (this->isUnsizedArray()) { | 273 if (this->isUnsizedArray()) { |
274 out->appendf("%s %s[]", | 274 out->appendf("%s %s[]", |
275 GrGLSLTypeString(effectiveType), | 275 GrGLSLTypeString(effectiveType), |
276 this->getName().c_str()); | 276 this->getName().c_str()); |
277 } else { | 277 } else { |
278 SkASSERT(this->getArrayCount() > 0); | 278 SkASSERT(this->getArrayCount() > 0); |
279 out->appendf("%s %s[%d]", | 279 out->appendf("%s %s[%d]", |
280 GrGLSLTypeString(effectiveType), | 280 GrGLSLTypeString(effectiveType), |
(...skipping 14 matching lines...) Expand all Loading... |
295 fUseUniformFloatArrays ? "" : ".x"); | 295 fUseUniformFloatArrays ? "" : ".x"); |
296 } | 296 } |
297 | 297 |
298 void appendArrayAccess(const char* indexName, SkString* out) const { | 298 void appendArrayAccess(const char* indexName, SkString* out) const { |
299 out->appendf("%s[%s]%s", | 299 out->appendf("%s[%s]%s", |
300 this->getName().c_str(), | 300 this->getName().c_str(), |
301 indexName, | 301 indexName, |
302 fUseUniformFloatArrays ? "" : ".x"); | 302 fUseUniformFloatArrays ? "" : ".x"); |
303 } | 303 } |
304 | 304 |
305 static const char* PrecisionString(Precision p, GrGLBinding binding) { | 305 static const char* PrecisionString(Precision p, GrGLStandard standard) { |
306 // Desktop GLSL has added precision qualifiers but they don't do anythin
g. | 306 // Desktop GLSL has added precision qualifiers but they don't do anythin
g. |
307 if (kES_GrGLBinding == binding) { | 307 if (kGLES_GrGLStandard == standard) { |
308 switch (p) { | 308 switch (p) { |
309 case kLow_Precision: | 309 case kLow_Precision: |
310 return "lowp "; | 310 return "lowp "; |
311 case kMedium_Precision: | 311 case kMedium_Precision: |
312 return "mediump "; | 312 return "mediump "; |
313 case kHigh_Precision: | 313 case kHigh_Precision: |
314 return "highp "; | 314 return "highp "; |
315 case kDefault_Precision: | 315 case kDefault_Precision: |
316 return ""; | 316 return ""; |
317 default: | 317 default: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 SkString fName; | 351 SkString fName; |
352 int fCount; | 352 int fCount; |
353 Precision fPrecision; | 353 Precision fPrecision; |
354 Origin fOrigin; | 354 Origin fOrigin; |
355 /// Work around driver bugs on some hardware that don't correctly | 355 /// Work around driver bugs on some hardware that don't correctly |
356 /// support uniform float [] | 356 /// support uniform float [] |
357 bool fUseUniformFloatArrays; | 357 bool fUseUniformFloatArrays; |
358 }; | 358 }; |
359 | 359 |
360 #endif | 360 #endif |
OLD | NEW |