Reduce the minimum scratch size to 16, don't look for next pow2 larger sizes.
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Mar 2013 16:35:49 +0000 (16:35 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 6 Mar 2013 16:35:49 +0000 (16:35 +0000)
Review URL: https://codereview.chromium.org/12475007

git-svn-id: http://skia.googlecode.com/svn/trunk@8007 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/GrContext.cpp

index a3b26a6..2b3d2a9 100644 (file)
@@ -428,7 +428,7 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra
 
     if (kApprox_ScratchTexMatch == match) {
         // bin by pow2 with a reasonable min
-        static const int MIN_SIZE = 256;
+        static const int MIN_SIZE = 16;
         desc.fWidth  = GrMax(MIN_SIZE, GrNextPow2(desc.fWidth));
         desc.fHeight = GrMax(MIN_SIZE, GrNextPow2(desc.fHeight));
     }
@@ -455,23 +455,13 @@ GrTexture* GrContext::lockAndRefScratchTexture(const GrTextureDesc& inDesc, Scra
         if (kExact_ScratchTexMatch == match) {
             break;
         }
-        // We had a cache miss and we are in approx mode, relax the fit of the flags... then try
-        // doubling width... then the height.
+        // We had a cache miss and we are in approx mode, relax the fit of the flags.
 
         // We no longer try to reuse textures that were previously used as render targets in
         // situations where no RT is needed; doing otherwise can confuse the video driver and
         // cause significant performance problems in some cases.
         if (desc.fFlags & kNoStencil_GrTextureFlagBit) {
             desc.fFlags = desc.fFlags & ~kNoStencil_GrTextureFlagBit;
-        } else if (!doubledW) {
-            desc.fFlags = inDesc.fFlags;
-            desc.fWidth *= 2;
-            doubledW = true;
-        } else if (!doubledH) {
-            desc.fFlags = inDesc.fFlags;
-            desc.fWidth = origWidth;
-            desc.fHeight *= 2;
-            doubledH = true;
         } else {
             break;
         }