Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: src/gpu/glsl/GrGLSLShaderBuilder.cpp

Issue 1594483003: Texturing support for RECTANGLE textures. (Closed) Base URL: https://skia.googlesource.com/skia.git@rectangle
Patch Set: fix float->int warnings Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/SkGLContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/gpu/gl/SkGLContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698