| 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 "GrSwizzle.h" | 8 #include "GrSwizzle.h" |
| 9 #include "glsl/GrGLSLShaderBuilder.h" | 9 #include "glsl/GrGLSLShaderBuilder.h" |
| 10 #include "glsl/GrGLSLCaps.h" | 10 #include "glsl/GrGLSLCaps.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 this->functions().append(body); | 55 this->functions().append(body); |
| 56 this->functions().append("}\n\n"); | 56 this->functions().append("}\n\n"); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void GrGLSLShaderBuilder::appendTextureLookup(SkString* out, | 59 void GrGLSLShaderBuilder::appendTextureLookup(SkString* out, |
| 60 const GrGLSLTextureSampler& sample
r, | 60 const GrGLSLTextureSampler& sample
r, |
| 61 const char* coordName, | 61 const char* coordName, |
| 62 GrSLType varyingType) const { | 62 GrSLType varyingType) const { |
| 63 const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); | 63 const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); |
| 64 GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler(); | 64 GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler(); |
| 65 GrSLType samplerType = uniformHandler->getUniformVariable(sampler.fSamplerUn
iform).getType(); |
| 65 out->appendf("%s(%s, %s)", | 66 out->appendf("%s(%s, %s)", |
| 66 GrGLSLTexture2DFunctionName(varyingType, glslCaps->generation()
), | 67 GrGLSLTexture2DFunctionName(varyingType, samplerType, glslCaps-
>generation()), |
| 67 uniformHandler->getUniformCStr(sampler.fSamplerUniform), | 68 uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
| 68 coordName); | 69 coordName); |
| 69 | 70 |
| 70 // This refers to any swizzling we may need to get from some backend interna
l format to the | 71 // This refers to any swizzling we may need to get from some backend interna
l format to the |
| 71 // format used in GrPixelConfig. If this is implemented by the GrGpu object,
then swizzle will | 72 // format used in GrPixelConfig. If this is implemented by the GrGpu object,
then swizzle will |
| 72 // be rgba. For shader prettiness we omit the swizzle rather than appending
".rgba". | 73 // be rgba. For shader prettiness we omit the swizzle rather than appending
".rgba". |
| 73 const GrSwizzle& configSwizzle = glslCaps->configTextureSwizzle(sampler.conf
ig()); | 74 const GrSwizzle& configSwizzle = glslCaps->configTextureSwizzle(sampler.conf
ig()); |
| 74 | 75 |
| 75 if (configSwizzle != GrSwizzle::RGBA()) { | 76 if (configSwizzle != GrSwizzle::RGBA()) { |
| 76 out->appendf(".%s", configSwizzle.c_str()); | 77 out->appendf(".%s", configSwizzle.c_str()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 this->code().append("}"); | 148 this->code().append("}"); |
| 148 | 149 |
| 149 for (int i = 0; i <= fCodeIndex; i++) { | 150 for (int i = 0; i <= fCodeIndex; i++) { |
| 150 fCompilerStrings[i] = fShaderStrings[i].c_str(); | 151 fCompilerStrings[i] = fShaderStrings[i].c_str(); |
| 151 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); | 152 fCompilerStringLengths[i] = (int)fShaderStrings[i].size(); |
| 152 } | 153 } |
| 153 | 154 |
| 154 fFinalized = true; | 155 fFinalized = true; |
| 155 } | 156 } |
| 156 | 157 |
| OLD | NEW |