diff options
author | 2017-09-20 20:50:37 +0000 | |
---|---|---|
committer | 2017-09-20 20:50:50 +0000 | |
commit | 76d640d14ea78e1f827a2f545e7f0729cdc2896f (patch) | |
tree | 807a1db51245b15ca045f822f3e36c1f4c9e2eb0 /src/gpu/GrResourceCache.cpp | |
parent | 0ca21466da7441baf471966be8c628d408752a72 (diff) |
Revert "Add native caching of uniquely keyed GrTextureProxies"
This reverts commit d4f100dad90ed5beb1b614464d8c4fcb22c0a993.
Reason for revert: ASAN
Original change's description:
> Add native caching of uniquely keyed GrTextureProxies
>
> Change-Id: I303fe025b7856b8d681a2d35b416c015bd468e1d
> Reviewed-on: https://skia-review.googlesource.com/48300
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,brianosman@google.com
Change-Id: I7bbf549d4855ce6d985867c3880eef80080bd3d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/49442
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrResourceCache.cpp')
-rw-r--r-- | src/gpu/GrResourceCache.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp index c207b44a38..f6170c01b6 100644 --- a/src/gpu/GrResourceCache.cpp +++ b/src/gpu/GrResourceCache.cpp @@ -10,8 +10,6 @@ #include "GrCaps.h" #include "GrGpuResourceCacheAccess.h" -#include "GrTexture.h" -#include "GrTextureProxyCacheAccess.h" #include "GrTracing.h" #include "SkGr.h" #include "SkMessageBus.h" @@ -580,8 +578,6 @@ void GrResourceCache::purgeUnlockedResources(size_t bytesToPurge, bool preferScr void GrResourceCache::processInvalidUniqueKeys( const SkTArray<GrUniqueKeyInvalidatedMessage>& msgs) { for (int i = 0; i < msgs.count(); ++i) { - this->processInvalidProxyUniqueKey(msgs[i].key()); - GrGpuResource* resource = this->findAndRefUniqueResource(msgs[i].key()); if (resource) { resource->resourcePriv().removeUniqueKey(); @@ -851,63 +847,3 @@ bool GrResourceCache::isInCache(const GrGpuResource* resource) const { } #endif - -void GrResourceCache::assignUniqueKeyToProxy(const GrUniqueKey& key, GrTextureProxy* proxy) { - SkASSERT(key.isValid()); - SkASSERT(proxy); - - // If there is already a GrResource with this key then the caller has violated the normal - // usage pattern of uniquely keyed resources (e.g., they have created one w/o first seeing - // if it already existed in the cache). - SkASSERT(!this->findAndRefUniqueResource(key)); - - // Uncached resources can never have a unique key, unless they're wrapped resources. Wrapped - // resources are a special case: the unique keys give us a weak ref so that we can reuse the - // same resource (rather than re-wrapping). When a wrapped resource is no longer referenced, - // it will always be released - it is never converted to a scratch resource. - if (SkBudgeted::kNo == proxy->isBudgeted() && - (!proxy->priv().isInstantiated() || - !proxy->priv().peekSurface()->resourcePriv().refsWrappedObjects())) { - return; - } - - SkASSERT(!fUniquelyKeyedProxies.find(key)); // multiple proxies can't get the same key - - proxy->cacheAccess().setUniqueKey(this, key); - SkASSERT(proxy->getUniqueKey() == key); - fUniquelyKeyedProxies.add(proxy); -} - -sk_sp<GrTextureProxy> GrResourceCache::findProxyByUniqueKey(const GrUniqueKey& key, - GrSurfaceOrigin origin) { - - sk_sp<GrTextureProxy> result = sk_ref_sp(fUniquelyKeyedProxies.find(key)); - if (result) { - SkASSERT(result->origin() == origin); - return result; - } - - GrGpuResource* resource = findAndRefUniqueResource(key); - if (!resource) { - return nullptr; - } - - sk_sp<GrTexture> texture(static_cast<GrSurface*>(resource)->asTexture()); - SkASSERT(texture); - - result = GrSurfaceProxy::MakeWrapped(std::move(texture), origin); - SkASSERT(result->getUniqueKey() == key); - fUniquelyKeyedProxies.add(result.get()); - return result; -} - -void GrResourceCache::processInvalidProxyUniqueKey(const GrUniqueKey& key) { - // Note: this method is called for the whole variety of GrGpuResources so often 'key' - // will not be in 'fUniquelyKeyedProxies'. - GrTextureProxy* proxy = fUniquelyKeyedProxies.find(key); - if (proxy) { - fUniquelyKeyedProxies.remove(key); - proxy->cacheAccess().clearUniqueKey(); - } -} - |