diff options
author | 2016-11-04 11:54:32 -0400 | |
---|---|---|
committer | 2016-11-04 16:25:25 +0000 | |
commit | 4d53c44aa6e8e0d1b6537f83e4287e5a1423ac75 (patch) | |
tree | ca7e88b141ef8667921b1ade269e7e2c838b13c0 /src/gpu/gl | |
parent | 9598c2fbc29ddb5e5d86c5b82b401b62cee02775 (diff) |
Limit GL_TEXTURE_RECTANGLE filtering to bilinear.
Adds a clamp for GrTexture filtering that can be set by a subclass at construction. The clamping is performed by GrTextureParams. GrGLTexture limits filtering to bilinear for rectangle and external textures.
Also moves samplerType() to GrTexturePriv from GrTexture.
BUG=skia:5932
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4352
Change-Id: I1f023d4f4133e7eb393367580c0558257e56c8db
Reviewed-on: https://skia-review.googlesource.com/4352
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLTexture.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index ec0ad3b7f3..c45d08f93c 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -12,7 +12,7 @@ #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) -inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrGLGpu* gpu) { +static inline GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrGLGpu* gpu) { if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) { SkASSERT(gpu->glCaps().glslCaps()->externalTextureSupport()); return kTextureExternalSampler_GrSLType; @@ -25,11 +25,19 @@ inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrG } } +static inline GrTextureParams::FilterMode highest_filter_mode(const GrGLTexture::IDDesc& idDesc) { + if (idDesc.fInfo.fTarget == GR_GL_TEXTURE_RECTANGLE || + idDesc.fInfo.fTarget == GR_GL_TEXTURE_EXTERNAL) { + return GrTextureParams::kBilerp_FilterMode; + } + return GrTextureParams::kMipMap_FilterMode; +} + // Because this class is virtually derived from GrSurface we must explicitly call its constructor. GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, const IDDesc& idDesc) : GrSurface(gpu, desc) - , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { + , INHERITED(gpu, desc, sampler_type(idDesc, gpu), highest_filter_mode(idDesc), false) { this->init(desc, idDesc); this->registerWithCache(budgeted); } @@ -38,14 +46,15 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& const IDDesc& idDesc, bool wasMipMapDataProvided) : GrSurface(gpu, desc) - , INHERITED(gpu, desc, sampler_type(idDesc, gpu), wasMipMapDataProvided) { + , INHERITED(gpu, desc, sampler_type(idDesc, gpu), highest_filter_mode(idDesc), + wasMipMapDataProvided) { this->init(desc, idDesc); this->registerWithCache(budgeted); } GrGLTexture::GrGLTexture(GrGLGpu* gpu, Wrapped, const GrSurfaceDesc& desc, const IDDesc& idDesc) : GrSurface(gpu, desc) - , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { + , INHERITED(gpu, desc, sampler_type(idDesc, gpu), highest_filter_mode(idDesc), false) { this->init(desc, idDesc); this->registerWithCacheWrapped(); } @@ -53,7 +62,8 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, Wrapped, const GrSurfaceDesc& desc, const GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, bool wasMipMapDataProvided) : GrSurface(gpu, desc) - , INHERITED(gpu, desc, sampler_type(idDesc, gpu), wasMipMapDataProvided) { + , INHERITED(gpu, desc, sampler_type(idDesc, gpu), highest_filter_mode(idDesc), + wasMipMapDataProvided) { this->init(desc, idDesc); } |