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>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 4ea5733..b483054 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -163,8 +163,14 @@
SkASSERT(deleteImageProc && texImageCtx);
// 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
- // image is destroyed, so the texture will be removed at that time.
+ // 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. 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(
backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kYes, kRead_GrIOType);
if (!tex) {