aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-01-27 09:56:04 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-27 09:56:04 -0800
commite167f9660cca8327afe48ae8c526a44e14c60f0e (patch)
tree0c592af17ba00f35022c3c536771da220011b22c /src
parentf379ad3429b61eb1d86e916767258340df372538 (diff)
Fix GPU resource cache related assertions.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gpu/GrContext.cpp8
-rw-r--r--src/gpu/GrResourceCache2.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 6879b109cd..13b0bfaec5 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -502,9 +502,11 @@ GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM
GrTexture* texture = fGpu->createTexture(*desc, true, NULL, 0);
#ifdef SK_DEBUG
- GrScratchKey key;
- GrTexturePriv::ComputeScratchKey(*desc, &key);
- SkASSERT(NULL == texture || texture->cacheAccess().getScratchKey() == key);
+ if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
+ GrScratchKey key;
+ GrTexturePriv::ComputeScratchKey(*desc, &key);
+ SkASSERT(NULL == texture || texture->cacheAccess().getScratchKey() == key);
+ }
#endif
return texture;
}
diff --git a/src/gpu/GrResourceCache2.cpp b/src/gpu/GrResourceCache2.cpp
index c72fc7c5a8..65894d3314 100644
--- a/src/gpu/GrResourceCache2.cpp
+++ b/src/gpu/GrResourceCache2.cpp
@@ -217,7 +217,7 @@ GrGpuResource* GrResourceCache2::findAndRefScratchResource(const GrScratchKey& s
}
void GrResourceCache2::willRemoveScratchKey(const GrGpuResource* resource) {
- SkASSERT(resource->cacheAccess().isScratch());
+ SkASSERT(resource->cacheAccess().getScratchKey().isValid());
fScratchMap.remove(resource->cacheAccess().getScratchKey(), resource);
}