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 GrGLSL_DEFINED | 8 #ifndef GrGLSL_DEFINED |
9 #define GrGLSL_DEFINED | 9 #define GrGLSL_DEFINED |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 /** | 79 /** |
80 * Adds a line of GLSL code to declare the default precision for float types. | 80 * Adds a line of GLSL code to declare the default precision for float types. |
81 */ | 81 */ |
82 void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision, | 82 void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision, |
83 const GrGLSLCaps& glslCaps, | 83 const GrGLSLCaps& glslCaps, |
84 SkString* out); | 84 SkString* out); |
85 | 85 |
86 /** | 86 /** |
| 87 * Converts a GrSLPrecision to its corresponding GLSL precision qualifier. |
| 88 */ |
| 89 static inline const char* GrGLSLPrecisionString(GrSLPrecision p) { |
| 90 switch (p) { |
| 91 case kLow_GrSLPrecision: |
| 92 return "lowp"; |
| 93 case kMedium_GrSLPrecision: |
| 94 return "mediump"; |
| 95 case kHigh_GrSLPrecision: |
| 96 return "highp"; |
| 97 default: |
| 98 SkFAIL("Unexpected precision type."); |
| 99 return ""; |
| 100 } |
| 101 } |
| 102 |
| 103 /** |
87 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty
pe. | 104 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty
pe. |
88 */ | 105 */ |
89 static inline const char* GrGLSLTypeString(GrSLType t) { | 106 static inline const char* GrGLSLTypeString(GrSLType t) { |
90 switch (t) { | 107 switch (t) { |
91 case kVoid_GrSLType: | 108 case kVoid_GrSLType: |
92 return "void"; | 109 return "void"; |
93 case kFloat_GrSLType: | 110 case kFloat_GrSLType: |
94 return "float"; | 111 return "float"; |
95 case kVec2f_GrSLType: | 112 case kVec2f_GrSLType: |
96 return "vec2"; | 113 return "vec2"; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 374 |
358 /** | 375 /** |
359 * Does an inplace mul, *=, of vec4VarName by mulFactor. | 376 * Does an inplace mul, *=, of vec4VarName by mulFactor. |
360 * A semicolon is added after the assignment. | 377 * A semicolon is added after the assignment. |
361 */ | 378 */ |
362 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); | 379 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); |
363 | 380 |
364 #include "GrGLSL_impl.h" | 381 #include "GrGLSL_impl.h" |
365 | 382 |
366 #endif | 383 #endif |
OLD | NEW |