diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-07-26 20:40:06 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-07-26 20:40:06 +0000 |
commit | 149f4f5b4013f3d28017fd548e43b69133be83c3 (patch) | |
tree | a8a1f94b301d7d77babb3f833621c46b20d2caf1 /src/gpu | |
parent | 0989b21d5a0278bc0e9eb8c85c1643ef2116ea86 (diff) |
differentiate mag and min filters
BUG=
R=bsalomon@google.com, robertphillips@google.com
Author: humper@google.com
Review URL: https://chromiumcodereview.appspot.com/20809002
git-svn-id: http://skia.googlecode.com/svn/trunk@10397 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGLTexture.h | 3 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 26 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h index 025faded72..e41ebc87ab 100644 --- a/src/gpu/gl/GrGLTexture.h +++ b/src/gpu/gl/GrGLTexture.h @@ -49,7 +49,8 @@ class GrGLTexture : public GrTexture { public: struct TexParams { - GrGLenum fFilter; + GrGLenum fMinFilter; + GrGLenum fMagFilter; GrGLenum fWrapS; GrGLenum fWrapT; GrGLenum fSwizzleRGBA[4]; diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 149025aa0d..98db317109 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -966,15 +966,16 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc, GrGLTexture::TexParams initialTexParams; // we only set a subset here so invalidate first initialTexParams.invalidate(); - initialTexParams.fFilter = GR_GL_NEAREST; + initialTexParams.fMinFilter = GR_GL_NEAREST; + initialTexParams.fMagFilter = GR_GL_NEAREST; initialTexParams.fWrapS = GR_GL_CLAMP_TO_EDGE; initialTexParams.fWrapT = GR_GL_CLAMP_TO_EDGE; GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, - initialTexParams.fFilter)); + initialTexParams.fMagFilter)); GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, - initialTexParams.fFilter)); + initialTexParams.fMinFilter)); GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_WRAP_S, initialTexParams.fWrapS)); @@ -2016,12 +2017,18 @@ void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur bool setAll = timestamp < this->getResetTimestamp(); GrGLTexture::TexParams newTexParams; - static GrGLenum glFilterModes[] = { + static GrGLenum glMinFilterModes[] = { GR_GL_NEAREST, GR_GL_LINEAR, GR_GL_LINEAR_MIPMAP_LINEAR }; - newTexParams.fFilter = glFilterModes[params.filterMode()]; + static GrGLenum glMagFilterModes[] = { + GR_GL_NEAREST, + GR_GL_LINEAR, + GR_GL_LINEAR + }; + newTexParams.fMinFilter = glMinFilterModes[params.filterMode()]; + newTexParams.fMagFilter = glMagFilterModes[params.filterMode()]; #ifndef SKIA_IGNORE_GPU_MIPMAPS if (params.filterMode() == GrTextureParams::kMipMap_FilterMode && @@ -2037,14 +2044,17 @@ void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur memcpy(newTexParams.fSwizzleRGBA, GrGLShaderBuilder::GetTexParamSwizzle(texture->config(), this->glCaps()), sizeof(newTexParams.fSwizzleRGBA)); - if (setAll || newTexParams.fFilter != oldTexParams.fFilter) { + if (setAll || newTexParams.fMagFilter != oldTexParams.fMagFilter) { this->setTextureUnit(unitIdx); GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FILTER, - newTexParams.fFilter)); + newTexParams.fMagFilter)); + } + if (setAll || newTexParams.fMinFilter != oldTexParams.fMinFilter) { + this->setTextureUnit(unitIdx); GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MIN_FILTER, - newTexParams.fFilter)); + newTexParams.fMinFilter)); } if (setAll || newTexParams.fWrapS != oldTexParams.fWrapS) { this->setTextureUnit(unitIdx); |