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
This commit is contained in:
commit-bot@chromium.org 2013-07-26 20:40:06 +00:00
parent 0989b21d5a
commit 149f4f5b40
2 changed files with 20 additions and 9 deletions

View File

@ -49,7 +49,8 @@ class GrGLTexture : public GrTexture {
public:
struct TexParams {
GrGLenum fFilter;
GrGLenum fMinFilter;
GrGLenum fMagFilter;
GrGLenum fWrapS;
GrGLenum fWrapT;
GrGLenum fSwizzleRGBA[4];

View File

@ -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);