aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrResourceProvider.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-09-20 15:58:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-20 20:21:50 +0000
commitd4f100dad90ed5beb1b614464d8c4fcb22c0a993 (patch)
tree4194bbcbe1884a5454143a7579f656113cf8f00f /src/gpu/GrResourceProvider.cpp
parent8d4a5c75f07a70f71320a426f392783dbcf180ba (diff)
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>
Diffstat (limited to 'src/gpu/GrResourceProvider.cpp')
-rw-r--r--src/gpu/GrResourceProvider.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 8dce5497d8..0182baa977 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -292,7 +292,6 @@ void GrResourceProvider::assignUniqueKeyToTexture(const GrUniqueKey& key, GrText
this->assignUniqueKeyToResource(key, texture);
}
-// MDB TODO (caching): this side-steps the issue of texture proxies with unique IDs
void GrResourceProvider::assignUniqueKeyToProxy(const GrUniqueKey& key, GrTextureProxy* proxy) {
ASSERT_SINGLE_OWNER
SkASSERT(key.isValid());
@@ -300,25 +299,13 @@ void GrResourceProvider::assignUniqueKeyToProxy(const GrUniqueKey& key, GrTextur
return;
}
- if (!proxy->instantiate(this)) {
- return;
- }
- GrTexture* texture = proxy->priv().peekTexture();
-
- this->assignUniqueKeyToResource(key, texture);
+ fCache->assignUniqueKeyToProxy(key, proxy);
}
-// MDB TODO (caching): this side-steps the issue of texture proxies with unique IDs
sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey& key,
GrSurfaceOrigin origin) {
ASSERT_SINGLE_OWNER
-
- sk_sp<GrTexture> texture(this->findAndRefTextureByUniqueKey(key));
- if (!texture) {
- return nullptr;
- }
-
- return GrSurfaceProxy::MakeWrapped(std::move(texture), origin);
+ return this->isAbandoned() ? nullptr : fCache->findProxyByUniqueKey(key, origin);
}
const GrBuffer* GrResourceProvider::createPatternedIndexBuffer(const uint16_t* pattern,