diff options
author | bsalomon <bsalomon@google.com> | 2015-01-27 09:56:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-27 09:56:04 -0800 |
commit | e167f9660cca8327afe48ae8c526a44e14c60f0e (patch) | |
tree | 0c592af17ba00f35022c3c536771da220011b22c /src | |
parent | f379ad3429b61eb1d86e916767258340df372538 (diff) |
Fix GPU resource cache related assertions.
Review URL: https://codereview.chromium.org/879963003
Diffstat (limited to 'src')
-rwxr-xr-x | src/gpu/GrContext.cpp | 8 | ||||
-rw-r--r-- | src/gpu/GrResourceCache2.cpp | 2 |
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); } |