Add more clarity to why we use GrWrapCacheable::kYes in AHWB generator.

Change-Id: Ica5542466ef8db1c72506edebd1360b27e65dab6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378779
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2021-03-03 10:29:51 -05:00 committed by Skia Commit-Bot
parent 23521a8d69
commit 874b3fb3c5

View File

@ -163,8 +163,14 @@ GrSurfaceProxyView GrAHardwareBufferImageGenerator::makeView(GrRecordingContext*
SkASSERT(deleteImageProc && texImageCtx); SkASSERT(deleteImageProc && texImageCtx);
// We make this texture cacheable to avoid recreating a GrTexture every time this // We make this texture cacheable to avoid recreating a GrTexture every time this
// is invoked. We know the owning SkIamge will send an invalidation message when the // is invoked. We know the owning SkImage will send an invalidation message when the
// image is destroyed, so the texture will be removed at that time. // image is destroyed, so the texture will be removed at that time. Note that the
// proxy will be keyed in GrProxyProvider but that cache just allows extant proxies
// to be reused. It does not retain them. After a flush the proxy will be deleted
// and a subsequent use of the image will recreate a new proxy around the GrTexture
// found in the GrResourceCache.
// This is the last use of GrWrapCacheable::kYes so if we actually cached the proxy
// we could remove wrapped GrGpuResource caching.
sk_sp<GrTexture> tex = resourceProvider->wrapBackendTexture( sk_sp<GrTexture> tex = resourceProvider->wrapBackendTexture(
backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kYes, kRead_GrIOType); backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kYes, kRead_GrIOType);
if (!tex) { if (!tex) {