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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 */ | 50 */ |
51 bool GrGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation); | 51 bool GrGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation); |
52 | 52 |
53 /** | 53 /** |
54 * Returns a string to include at the beginning of a shader to declare the GLSL | 54 * Returns a string to include at the beginning of a shader to declare the GLSL |
55 * version. | 55 * version. |
56 */ | 56 */ |
57 const char* GrGetGLSLVersionDecl(const GrGLContextInfo&); | 57 const char* GrGetGLSLVersionDecl(const GrGLContextInfo&); |
58 | 58 |
59 /** | 59 /** |
60 * Adds a line of GLSL code to declare the default precision for float types. | |
61 */ | |
62 void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision, GrGLStandard, S
kString* out); | |
63 | |
64 /** | |
65 * Gets the name of the function that should be used to sample a 2D texture. Coo
rd type is used | |
66 * to indicate whether the texture is sampled using projective textured (kVec3f)
or not (kVec2f). | |
67 */ | |
68 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrGLSLGenerat
ion glslGen) { | |
69 if (kVec2f_GrSLType == coordType) { | |
70 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D"; | |
71 } else { | |
72 SkASSERT(kVec3f_GrSLType == coordType); | |
73 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj
"; | |
74 } | |
75 } | |
76 | |
77 /** | |
78 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty
pe. | 60 * Converts a GrSLType to a string containing the name of the equivalent GLSL ty
pe. |
79 */ | 61 */ |
80 static inline const char* GrGLSLTypeString(GrSLType t) { | 62 static inline const char* GrGLSLTypeString(GrSLType t) { |
81 switch (t) { | 63 switch (t) { |
82 case kVoid_GrSLType: | 64 case kVoid_GrSLType: |
83 return "void"; | 65 return "void"; |
84 case kFloat_GrSLType: | 66 case kFloat_GrSLType: |
85 return "float"; | 67 return "float"; |
86 case kVec2f_GrSLType: | 68 case kVec2f_GrSLType: |
87 return "vec2"; | 69 return "vec2"; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 318 |
337 /** | 319 /** |
338 * Does an inplace mul, *=, of vec4VarName by mulFactor. | 320 * Does an inplace mul, *=, of vec4VarName by mulFactor. |
339 * A semicolon is added after the assignment. | 321 * A semicolon is added after the assignment. |
340 */ | 322 */ |
341 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); | 323 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); |
342 | 324 |
343 #include "GrGLSL_impl.h" | 325 #include "GrGLSL_impl.h" |
344 | 326 |
345 #endif | 327 #endif |
OLD | NEW |