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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: |
318 GrCrash("Unexpected precision type."); | 318 SkFAIL("Unexpected precision type."); |
319 } | 319 } |
320 } | 320 } |
321 return ""; | 321 return ""; |
322 } | 322 } |
323 | 323 |
324 private: | 324 private: |
325 static const char* TypeModifierString(TypeModifier t, GrGLSLGeneration gen)
{ | 325 static const char* TypeModifierString(TypeModifier t, GrGLSLGeneration gen)
{ |
326 switch (t) { | 326 switch (t) { |
327 case kNone_TypeModifier: | 327 case kNone_TypeModifier: |
328 return ""; | 328 return ""; |
329 case kIn_TypeModifier: | 329 case kIn_TypeModifier: |
330 return "in"; | 330 return "in"; |
331 case kInOut_TypeModifier: | 331 case kInOut_TypeModifier: |
332 return "inout"; | 332 return "inout"; |
333 case kOut_TypeModifier: | 333 case kOut_TypeModifier: |
334 return "out"; | 334 return "out"; |
335 case kUniform_TypeModifier: | 335 case kUniform_TypeModifier: |
336 return "uniform"; | 336 return "uniform"; |
337 case kAttribute_TypeModifier: | 337 case kAttribute_TypeModifier: |
338 return k110_GrGLSLGeneration == gen ? "attribute" : "in"; | 338 return k110_GrGLSLGeneration == gen ? "attribute" : "in"; |
339 case kVaryingIn_TypeModifier: | 339 case kVaryingIn_TypeModifier: |
340 return k110_GrGLSLGeneration == gen ? "varying" : "in"; | 340 return k110_GrGLSLGeneration == gen ? "varying" : "in"; |
341 case kVaryingOut_TypeModifier: | 341 case kVaryingOut_TypeModifier: |
342 return k110_GrGLSLGeneration == gen ? "varying" : "out"; | 342 return k110_GrGLSLGeneration == gen ? "varying" : "out"; |
343 default: | 343 default: |
344 GrCrash("Unknown shader variable type modifier."); | 344 SkFAIL("Unknown shader variable type modifier."); |
345 return ""; // suppress warning | 345 return ""; // suppress warning |
346 } | 346 } |
347 } | 347 } |
348 | 348 |
349 GrSLType fType; | 349 GrSLType fType; |
350 TypeModifier fTypeModifier; | 350 TypeModifier fTypeModifier; |
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 |