Revert of Use presence of a content key as non-scratch indicator (patchset #5 id:80001 of https://codereview.chromium.org/639873002/)
Reason for revert:
breaking nanobench on ubuntu
Original issue's description:
> Use presence of a content key as non-scratch indicator
>
> BUG=skia:2889
>
> Committed: https://skia.googlesource.com/skia/+/9eefe0851eeaa8ded05b4774ebcb38ed201d5dbf
TBR=robertphillips@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2889
Review URL: https://codereview.chromium.org/642493003
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index f50ed7d..c683b5b 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -6,10 +6,13 @@
* found in the LICENSE file.
*/
+
+
#include "GrResourceCache.h"
#include "GrGpuResource.h"
#include "GrTexturePriv.h"
+
DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage);
///////////////////////////////////////////////////////////////////////////////
@@ -178,7 +181,7 @@
// scratch texture reuse is turned off.
SkASSERT(resource->getCacheEntry());
if (resource->getCacheEntry()->key().getResourceType() == GrTexturePriv::ResourceType() &&
- resource->getCacheEntry()->key().isScratch() &&
+ resource->fIsScratch &&
!fCaps->reuseScratchTextures() &&
!(static_cast<const GrTexture*>(resource)->desc().fFlags &
kRenderTarget_GrTextureFlagBit)) {
@@ -187,12 +190,12 @@
}
GrGpuResource* GrResourceCache::find(const GrResourceKey& key) {
- // GrResourceCache2 is responsible for scratch resources.
- SkASSERT(!key.isScratch());
-
GrAutoResourceCacheValidate atcv(this);
- GrResourceCacheEntry* entry = fCache.find(key);
+ GrResourceCacheEntry* entry = NULL;
+
+ entry = fCache.find(key);
+
if (NULL == entry) {
return NULL;
}
@@ -201,6 +204,8 @@
this->internalDetach(entry);
this->attachToHead(entry);
+ // GrResourceCache2 is responsible for scratch resources.
+ SkASSERT(GrGpuResource::kNo_IsScratch == entry->resource()->fIsScratch);
return entry->fResource;
}