Index: src/gpu/glsl/GrGLSLShaderBuilder.cpp |
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp |
index f1ede1decd7ce6c589264a95e4805077d26c0a23..a2cf66cb4097c591f6a5014328356291d8acc09c 100644 |
--- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp |
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp |
@@ -63,10 +63,29 @@ void GrGLSLShaderBuilder::appendTextureLookup(SkString* out, |
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); |
GrGLSLUniformHandler* uniformHandler = fProgramBuilder->uniformHandler(); |
GrSLType samplerType = uniformHandler->getUniformVariable(sampler.fSamplerUniform).getType(); |
- out->appendf("%s(%s, %s)", |
- GrGLSLTexture2DFunctionName(varyingType, samplerType, glslCaps->generation()), |
- uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
- coordName); |
+ if (samplerType == kSampler2DRect_GrSLType) { |
+ if (varyingType == kVec2f_GrSLType) { |
+ out->appendf("%s(%s, textureSize(%s) * %s)", |
+ GrGLSLTexture2DFunctionName(varyingType, samplerType, |
+ glslCaps->generation()), |
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
+ coordName); |
+ } else { |
+ out->appendf("%s(%s, vec3(textureSize(%s) * %s.xy, %s.z))", |
+ GrGLSLTexture2DFunctionName(varyingType, samplerType, |
+ glslCaps->generation()), |
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
+ coordName, |
+ coordName); |
+ } |
+ } else { |
+ out->appendf("%s(%s, %s)", |
+ GrGLSLTexture2DFunctionName(varyingType, samplerType, glslCaps->generation()), |
+ uniformHandler->getUniformCStr(sampler.fSamplerUniform), |
+ coordName); |
+ } |
// This refers to any swizzling we may need to get from some backend internal format to the |
// format used in GrPixelConfig. If this is implemented by the GrGpu object, then swizzle will |