OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "GrGLShaderBuilder.h" | 8 #include "GrGLShaderBuilder.h" |
9 #include "GrGLProgramBuilder.h" | 9 #include "GrGLProgramBuilder.h" |
10 #include "../GrGpuGL.h" | 10 #include "../GrGpuGL.h" |
11 #include "../GrGLShaderVar.h" | 11 #include "../GrGLShaderVar.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 inline const char* sample_function_name(GrSLType type, GrGLSLGeneration glslGen)
{ | 14 inline const char* sample_function_name(GrSLType type, GrGLSLGeneration glslGen)
{ |
15 if (kVec2f_GrSLType == type) { | 15 if (kVec2f_GrSLType == type) { |
16 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D"; | 16 return glslGen >= k130_GrGLSLGeneration ? "texture" : "texture2D"; |
17 } else { | 17 } else { |
18 SkASSERT(kVec3f_GrSLType == type); | 18 SkASSERT(kVec3f_GrSLType == type); |
19 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj
"; | 19 return glslGen >= k130_GrGLSLGeneration ? "textureProj" : "texture2DProj
"; |
20 } | 20 } |
21 } | 21 } |
22 void append_texture_lookup(SkString* out, | 22 void append_texture_lookup(SkString* out, |
23 GrGpuGL* gpu, | 23 GrGpuGL* gpu, |
24 const char* samplerName, | 24 const char* samplerName, |
25 const char* coordName, | 25 const char* coordName, |
26 uint32_t configComponentMask, | 26 uint32_t configComponentMask, |
27 const char* swizzle, | 27 const char* swizzle, |
28 GrSLType varyingType = kVec2f_GrSLType) { | 28 GrSLType varyingType = kVec2f_GrSLType) { |
29 SkASSERT(NULL != coordName); | 29 SkASSERT(coordName); |
30 | 30 |
31 out->appendf("%s(%s, %s)", | 31 out->appendf("%s(%s, %s)", |
32 sample_function_name(varyingType, gpu->glslGeneration()), | 32 sample_function_name(varyingType, gpu->glslGeneration()), |
33 samplerName, | 33 samplerName, |
34 coordName); | 34 coordName); |
35 | 35 |
36 char mangledSwizzle[5]; | 36 char mangledSwizzle[5]; |
37 | 37 |
38 // The swizzling occurs using texture params instead of shader-mangling if A
RB_texture_swizzle | 38 // The swizzling occurs using texture params instead of shader-mangling if A
RB_texture_swizzle |
39 // is available. | 39 // is available. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 coordName, | 152 coordName, |
153 configComponentMask, | 153 configComponentMask, |
154 swizzle, | 154 swizzle, |
155 kVec2f_GrSLType); | 155 kVec2f_GrSLType); |
156 } | 156 } |
157 | 157 |
158 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 158 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
159 GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGLFullProgramBuilder* program) | 159 GrGLFullShaderBuilder::GrGLFullShaderBuilder(GrGLFullProgramBuilder* program) |
160 : INHERITED(program) | 160 : INHERITED(program) |
161 , fFullProgramBuilder(program) {} | 161 , fFullProgramBuilder(program) {} |
OLD | NEW |