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
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index 025fade..e41ebc8 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -49,7 +49,8 @@
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 149025a..98db317 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -966,15 +966,16 @@
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 @@
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 @@
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);