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 19 matching lines...) Expand all Loading... | |
30 k140_GrGLSLGeneration, | 30 k140_GrGLSLGeneration, |
31 /** | 31 /** |
32 * Desktop GLSL 1.50 | 32 * Desktop GLSL 1.50 |
33 */ | 33 */ |
34 k150_GrGLSLGeneration, | 34 k150_GrGLSLGeneration, |
35 /** | 35 /** |
36 * Desktop GLSL 3.30, and ES GLSL 3.00 | 36 * Desktop GLSL 3.30, and ES GLSL 3.00 |
37 */ | 37 */ |
38 k330_GrGLSLGeneration, | 38 k330_GrGLSLGeneration, |
39 /** | 39 /** |
40 * Desktop GLSL 4.00 | |
41 */ | |
42 k400_GrGLSLGeneration, | |
43 /** | |
40 * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular | 44 * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular |
41 */ | 45 */ |
42 k310es_GrGLSLGeneration, | 46 k310es_GrGLSLGeneration, |
47 /** | |
48 * ES GLSL 3.20 | |
49 */ | |
50 k320es_GrGLSLGeneration, | |
43 }; | 51 }; |
44 | 52 |
45 bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); | 53 bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); |
46 | 54 |
47 /** | 55 /** |
48 * Gets the name of the function that should be used to sample a 2D texture. Coo rd type is used | 56 * Gets the name of the function that should be used to sample a 2D texture. Coo rd type is used |
49 * to indicate whether the texture is sampled using projective textured (kVec3f) or not (kVec2f). | 57 * to indicate whether the texture is sampled using projective textured (kVec3f) or not (kVec2f). |
50 */ | 58 */ |
51 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samp lerType, | 59 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samp lerType, |
52 GrGLSLGeneration glslGen) { | 60 GrGLSLGeneration glslGen) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 case kInt_GrSLType: | 113 case kInt_GrSLType: |
106 return "int"; | 114 return "int"; |
107 case kUint_GrSLType: | 115 case kUint_GrSLType: |
108 return "uint"; | 116 return "uint"; |
109 default: | 117 default: |
110 SkFAIL("Unknown shader var type."); | 118 SkFAIL("Unknown shader var type."); |
111 return ""; // suppress warning | 119 return ""; // suppress warning |
112 } | 120 } |
113 } | 121 } |
114 | 122 |
123 /** | |
124 * Returns the minimum precision that can fully represent an int with the provid ed number of bits. | |
125 */ | |
126 static inline GrSLPrecision GrGLSLIntMinPrecisionForNBits(int bits) { | |
bsalomon
2016/02/12 20:58:17
If we're not using this can we remove it?
Chris Dalton
2016/02/12 21:01:50
Oops. Done.
| |
127 SkASSERT(bits <= 32); | |
128 if (bits <= 9) { // Lowp integers are spec'd to have at least 9 bits. | |
129 return kLow_GrSLPrecision; | |
130 } else if (bits <= 16) { | |
131 return kMedium_GrSLPrecision; | |
132 } else { | |
133 return kHigh_GrSLPrecision; | |
134 } | |
135 } | |
136 | |
115 /** A generic base-class representing a GLSL expression. | 137 /** A generic base-class representing a GLSL expression. |
116 * The instance can be a variable name, expression or vecN(0) or vecN(1). Does s imple constant | 138 * The instance can be a variable name, expression or vecN(0) or vecN(1). Does s imple constant |
117 * folding with help of 1 and 0. | 139 * folding with help of 1 and 0. |
118 * | 140 * |
119 * Clients should not use this class, rather the specific instantiations defined | 141 * Clients should not use this class, rather the specific instantiations defined |
120 * later, for example GrGLSLExpr4. | 142 * later, for example GrGLSLExpr4. |
121 */ | 143 */ |
122 template <typename Self> | 144 template <typename Self> |
123 class GrGLSLExpr { | 145 class GrGLSLExpr { |
124 public: | 146 public: |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 | 369 |
348 /** | 370 /** |
349 * Does an inplace mul, *=, of vec4VarName by mulFactor. | 371 * Does an inplace mul, *=, of vec4VarName by mulFactor. |
350 * A semicolon is added after the assignment. | 372 * A semicolon is added after the assignment. |
351 */ | 373 */ |
352 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor); | 374 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor); |
353 | 375 |
354 #include "GrGLSL_impl.h" | 376 #include "GrGLSL_impl.h" |
355 | 377 |
356 #endif | 378 #endif |
OLD | NEW |