Plumb in flag for reusing scratch textures

R=bsalomon@google.com, brian@thesalomons.net

Author: robertphillips@google.com

Review URL: https://chromiumcodereview.appspot.com/19636002

git-svn-id: http://skia.googlecode.com/svn/trunk@10170 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 9fdb0f4..e38f2a3 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -950,6 +950,8 @@
     fDualSourceBlendingSupport = false;
     fBufferLockSupport = false;
     fPathStencilingSupport = false;
+    fDstReadInShaderSupport = false;
+    fReuseScratchTextures = true;
 
     fMaxRenderTargetSize = 0;
     fMaxTextureSize = 0;
@@ -967,6 +969,8 @@
     fDualSourceBlendingSupport = other.fDualSourceBlendingSupport;
     fBufferLockSupport = other.fBufferLockSupport;
     fPathStencilingSupport = other.fPathStencilingSupport;
+    fDstReadInShaderSupport = other.fDstReadInShaderSupport;
+    fReuseScratchTextures = other.fReuseScratchTextures;
 
     fMaxRenderTargetSize = other.fMaxRenderTargetSize;
     fMaxTextureSize = other.fMaxTextureSize;
@@ -988,6 +992,7 @@
     GrPrintf("Buffer Lock Support         : %s\n", gNY[fBufferLockSupport]);
     GrPrintf("Path Stenciling Support     : %s\n", gNY[fPathStencilingSupport]);
     GrPrintf("Dst Read In Shader Support  : %s\n", gNY[fDstReadInShaderSupport]);
+    GrPrintf("Reuse Scratch Textures      : %s\n", gNY[fReuseScratchTextures]);
     GrPrintf("Max Texture Size            : %d\n", fMaxTextureSize);
     GrPrintf("Max Render Target Size      : %d\n", fMaxRenderTargetSize);
     GrPrintf("Max Sample Count            : %d\n", fMaxSampleCount);
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
index 236f939..ffacc9e 100644
--- a/src/gpu/GrDrawTargetCaps.h
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -36,6 +36,7 @@
     bool bufferLockSupport() const { return fBufferLockSupport; }
     bool pathStencilingSupport() const { return fPathStencilingSupport; }
     bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
+    bool reuseScratchTextures() const { return fReuseScratchTextures; }
 
     int maxRenderTargetSize() const { return fMaxRenderTargetSize; }
     int maxTextureSize() const { return fMaxTextureSize; }
@@ -54,6 +55,7 @@
     bool fBufferLockSupport         : 1;
     bool fPathStencilingSupport     : 1;
     bool fDstReadInShaderSupport    : 1;
+    bool fReuseScratchTextures      : 1;
 
     int fMaxRenderTargetSize;
     int fMaxTextureSize;
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 1770d05..d7b9992 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -289,6 +289,8 @@
 
     fDstReadInShaderSupport = kNone_FBFetchType != fFBFetchType;
 
+    fReuseScratchTextures = kARM_GrGLVendor != ctxInfo.vendor();
+
     // Enable supported shader-related caps
     if (kDesktop_GrGLBinding == binding) {
         fDualSourceBlendingSupport = ctxInfo.version() >= GR_GL_VER(3,3) ||