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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 }; | 51 }; |
52 | 52 |
53 bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); | 53 bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); |
54 | 54 |
55 /** | 55 /** |
56 * 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 |
57 * 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). |
58 */ | 58 */ |
59 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samp
lerType, | 59 inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samp
lerType, |
60 GrGLSLGeneration glslGen) { | 60 GrGLSLGeneration glslGen) { |
61 SkASSERT(GrSLTypeIsSamplerType(samplerType)); | 61 SkASSERT(GrSLTypeIs2DTextureType(samplerType)); |
62 SkASSERT(kVec2f_GrSLType == coordType || kVec3f_GrSLType == coordType); | 62 SkASSERT(kVec2f_GrSLType == coordType || kVec3f_GrSLType == coordType); |
63 // GL_TEXTURE_RECTANGLE_ARB is written against OpenGL 2.0/GLSL 1.10. At that
time there were | 63 // GL_TEXTURE_RECTANGLE_ARB is written against OpenGL 2.0/GLSL 1.10. At that
time there were |
64 // separate texture*() functions. In OpenGL 3.0/GLSL 1.30 the different text
ure*() functions | 64 // separate texture*() functions. In OpenGL 3.0/GLSL 1.30 the different text
ure*() functions |
65 // were deprecated in favor or the unified texture() function. RECTANGLE tex
tures became | 65 // were deprecated in favor or the unified texture() function. RECTANGLE tex
tures became |
66 // standard in OpenGL 3.2/GLSL 1.50 and use texture(). It isn't completely c
lear what function | 66 // standard in OpenGL 3.2/GLSL 1.50 and use texture(). It isn't completely c
lear what function |
67 // should be used for RECTANGLE textures in GLSL versions >= 1.30 && < 1.50.
We're going with | 67 // should be used for RECTANGLE textures in GLSL versions >= 1.30 && < 1.50.
We're going with |
68 // using texture(). | 68 // using texture(). |
69 if (glslGen >= k130_GrGLSLGeneration) { | 69 if (glslGen >= k130_GrGLSLGeneration) { |
70 return (kVec2f_GrSLType == coordType) ? "texture" : "textureProj"; | 70 return (kVec2f_GrSLType == coordType) ? "texture" : "textureProj"; |
71 } | 71 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 case kMat33f_GrSLType: | 120 case kMat33f_GrSLType: |
121 return "mat3"; | 121 return "mat3"; |
122 case kMat44f_GrSLType: | 122 case kMat44f_GrSLType: |
123 return "mat4"; | 123 return "mat4"; |
124 case kSampler2D_GrSLType: | 124 case kSampler2D_GrSLType: |
125 return "sampler2D"; | 125 return "sampler2D"; |
126 case kSamplerExternal_GrSLType: | 126 case kSamplerExternal_GrSLType: |
127 return "samplerExternalOES"; | 127 return "samplerExternalOES"; |
128 case kSampler2DRect_GrSLType: | 128 case kSampler2DRect_GrSLType: |
129 return "sampler2DRect"; | 129 return "sampler2DRect"; |
| 130 case kSamplerBuffer_GrSLType: |
| 131 return "samplerBuffer"; |
130 case kBool_GrSLType: | 132 case kBool_GrSLType: |
131 return "bool"; | 133 return "bool"; |
132 case kInt_GrSLType: | 134 case kInt_GrSLType: |
133 return "int"; | 135 return "int"; |
134 case kUint_GrSLType: | 136 case kUint_GrSLType: |
135 return "uint"; | 137 return "uint"; |
136 default: | 138 default: |
137 SkFAIL("Unknown shader var type."); | 139 SkFAIL("Unknown shader var type."); |
138 return ""; // suppress warning | 140 return ""; // suppress warning |
139 } | 141 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 376 |
375 /** | 377 /** |
376 * Does an inplace mul, *=, of vec4VarName by mulFactor. | 378 * Does an inplace mul, *=, of vec4VarName by mulFactor. |
377 * A semicolon is added after the assignment. | 379 * A semicolon is added after the assignment. |
378 */ | 380 */ |
379 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); | 381 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); |
380 | 382 |
381 #include "GrGLSL_impl.h" | 383 #include "GrGLSL_impl.h" |
382 | 384 |
383 #endif | 385 #endif |
OLD | NEW |