Zap the scratch key on non-RT textures when scratch textures are disabled.
Review URL: https://codereview.chromium.org/870103002
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index f523632..b7a064c 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -40,8 +40,8 @@
return NULL;
}
- if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) &&
- !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
+ bool isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
+ if (isRT && !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
return NULL;
}
@@ -71,6 +71,9 @@
}
}
}
+ if (!this->caps()->reuseScratchTextures() && !isRT) {
+ tex->cacheAccess().removeScratchKey();
+ }
return tex;
}