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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 */ | 49 */ |
50 k320es_GrGLSLGeneration, | 50 k320es_GrGLSLGeneration, |
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* GrGLSLTextureFunctionName(GrSLType coordType, GrSLType sample
rType, |
60 GrGLSLGeneration glslGen) { | 60 GrGLSLGeneration glslGen) { |
61 SkASSERT(GrSLTypeIsSamplerType(samplerType)); | 61 SkASSERT(GrSLTypeIsSamplerType(samplerType)); |
| 62 if (kSamplerBuffer_GrSLType == samplerType) { |
| 63 SkASSERT(kInt_GrSLType == coordType); |
| 64 return "texelFetch"; |
| 65 } |
62 SkASSERT(kVec2f_GrSLType == coordType || kVec3f_GrSLType == coordType); | 66 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 | 67 // 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 | 68 // 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 | 69 // 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 | 70 // 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 | 71 // should be used for RECTANGLE textures in GLSL versions >= 1.30 && < 1.50.
We're going with |
68 // using texture(). | 72 // using texture(). |
69 if (glslGen >= k130_GrGLSLGeneration) { | 73 if (glslGen >= k130_GrGLSLGeneration) { |
70 return (kVec2f_GrSLType == coordType) ? "texture" : "textureProj"; | 74 return (kVec2f_GrSLType == coordType) ? "texture" : "textureProj"; |
71 } | 75 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 case kMat33f_GrSLType: | 107 case kMat33f_GrSLType: |
104 return "mat3"; | 108 return "mat3"; |
105 case kMat44f_GrSLType: | 109 case kMat44f_GrSLType: |
106 return "mat4"; | 110 return "mat4"; |
107 case kSampler2D_GrSLType: | 111 case kSampler2D_GrSLType: |
108 return "sampler2D"; | 112 return "sampler2D"; |
109 case kSamplerExternal_GrSLType: | 113 case kSamplerExternal_GrSLType: |
110 return "samplerExternalOES"; | 114 return "samplerExternalOES"; |
111 case kSampler2DRect_GrSLType: | 115 case kSampler2DRect_GrSLType: |
112 return "sampler2DRect"; | 116 return "sampler2DRect"; |
| 117 case kSamplerBuffer_GrSLType: |
| 118 return "samplerBuffer"; |
113 case kBool_GrSLType: | 119 case kBool_GrSLType: |
114 return "bool"; | 120 return "bool"; |
115 case kInt_GrSLType: | 121 case kInt_GrSLType: |
116 return "int"; | 122 return "int"; |
117 case kUint_GrSLType: | 123 case kUint_GrSLType: |
118 return "uint"; | 124 return "uint"; |
119 default: | 125 default: |
120 SkFAIL("Unknown shader var type."); | 126 SkFAIL("Unknown shader var type."); |
121 return ""; // suppress warning | 127 return ""; // suppress warning |
122 } | 128 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 363 |
358 /** | 364 /** |
359 * Does an inplace mul, *=, of vec4VarName by mulFactor. | 365 * Does an inplace mul, *=, of vec4VarName by mulFactor. |
360 * A semicolon is added after the assignment. | 366 * A semicolon is added after the assignment. |
361 */ | 367 */ |
362 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); | 368 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL
Expr4& mulFactor); |
363 | 369 |
364 #include "GrGLSL_impl.h" | 370 #include "GrGLSL_impl.h" |
365 | 371 |
366 #endif | 372 #endif |
OLD | NEW |