Disable caching of GrTextures in promise images.

Leave the code to support it in place until we know if this causes
a regression.

Change-Id: Ic9f6a42cb83cc82a33a534d3f98cb9aaf11f813f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356998
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2021-01-22 09:26:53 -05:00 committed by Skia Commit-Bot
parent 84b0233bb3
commit 9374617a4c

View File

@ -306,6 +306,17 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
}
sk_sp<GrTexture> tex;
static bool kDisableCaching = true;
if (kDisableCaching) {
tex = resourceProvider->wrapBackendTexture(backendTexture,
kBorrow_GrWrapOwnership,
GrWrapCacheable::kYes,
kRead_GrIOType);
if (!tex) {
return {};
}
tex->setRelease(fReleaseHelper);
} else {
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
GrUniqueKey::Builder builder(&key, kDomain, 1, "promise");
@ -326,10 +337,11 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy(
return {};
}
}
// Because we're caching the GrTextureObject we have to use this "idle proc" mechanism
// to know when it's safe to delete the underlying backend texture.
// Because we're caching the GrTextureObject we have to use this "idle proc"
// mechanism to know when it's safe to delete the underlying backend texture.
tex->addIdleProc(std::move(fReleaseHelper));
promiseTexture->addKeyToInvalidate(tex->getContext()->priv().contextID(), key);
}
fTexture = tex.get();
// We need to hold on to the GrTexture in case our proxy gets reinstantiated. However,
// we can't unref in our destructor because we may be on another thread then. So we