Don't use MIP filter mode on compressed textures
authorbsalomon <bsalomon@google.com>
Thu, 23 Oct 2014 21:17:46 +0000 (14:17 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 23 Oct 2014 21:17:46 +0000 (14:17 -0700)
Add compressed texture image downsample GMs

BUG=chromium:426331

Review URL: https://codereview.chromium.org/672863003

expectations/gm/ignored-tests.txt
gm/downsamplebitmap.cpp
src/gpu/gl/GrGpuGL.cpp

index 900f085..976a2a8 100644 (file)
@@ -39,6 +39,9 @@ yuv_to_rgb_effect
 # robertphillips - skia:2995
 blurrects
 
+#bsalomon changes after fixing crbug.com/426331
+bitmapfilters
+
 # derekf https://codereview.chromium.org/639523002/
 simpleblurroundrect
 blurrects
index 19faaa0..1d204fc 100644 (file)
@@ -194,15 +194,23 @@ class DownsampleBitmapImageGM: public DownsampleBitmapGM {
 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kHigh_FilterLevel); )
 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kHigh_FilterLevel); )
 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kHigh_FilterLevel); )
+DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc",
+                                            SkPaint::kHigh_FilterLevel); )
 
 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kMedium_FilterLevel); )
 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_FilterLevel); )
 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_FilterLevel); )
+DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc",
+                                           SkPaint::kMedium_FilterLevel); )
 
 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); )
 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterLevel); )
 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_FilterLevel); )
+DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc",
+                                           SkPaint::kLow_FilterLevel); )
 
 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); )
 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_FilterLevel); )
 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_FilterLevel); )
+DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc",
+                                           SkPaint::kNone_FilterLevel); )
index 209edaa..c83a668 100644 (file)
@@ -2053,14 +2053,18 @@ void GrGpuGL::bindTexture(int unitIdx, const GrTextureParams& params, GrGLTextur
         GR_GL_LINEAR
     };
     GrTextureParams::FilterMode filterMode = params.filterMode();
-    if (!this->caps()->mipMapSupport() && GrTextureParams::kMipMap_FilterMode == filterMode) {
-        filterMode = GrTextureParams::kBilerp_FilterMode;
+
+    if (GrTextureParams::kMipMap_FilterMode == filterMode) {
+        if (!this->caps()->mipMapSupport() || GrPixelConfigIsCompressed(texture->config())) {
+            filterMode = GrTextureParams::kBilerp_FilterMode;
+        }
     }
+
     newTexParams.fMinFilter = glMinFilterModes[filterMode];
     newTexParams.fMagFilter = glMagFilterModes[filterMode];
 
     if (GrTextureParams::kMipMap_FilterMode == filterMode &&
-        texture->texturePriv().mipMapsAreDirty() && !GrPixelConfigIsCompressed(texture->config())) {
+        texture->texturePriv().mipMapsAreDirty()) {
         GL_CALL(GenerateMipmap(GR_GL_TEXTURE_2D));
         texture->texturePriv().dirtyMipMaps(false);
     }