Require explicit GrWrapCacheable specification in more places.
Make all wrapped resources be kUnbudgetedUncacheable except those
created by AHardwareBuffer image generators and as backings for promise
images.
Make all non-wrapped unbudgeted resources be kUnbudgetedUncacheable.
Update unit tests to mostly use GrWrapCacheable::kNo except where they
are testing the distinction.
Update unit tests for new expectations.
Bug: chromium:922851
Change-Id: I4d3bdaa161ffc76390f26334bcb7e2b47dd9319d
Reviewed-on: https://skia-review.googlesource.com/c/185004
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/mtl/GrMtlRenderTarget.mm b/src/gpu/mtl/GrMtlRenderTarget.mm
index 59fd479..07e5639 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.mm
+++ b/src/gpu/mtl/GrMtlRenderTarget.mm
@@ -10,18 +10,20 @@
#include "GrMtlGpu.h"
#include "GrMtlUtil.h"
+// Called for wrapped non-texture render targets.
GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
- SkBudgeted budgeted,
const GrSurfaceDesc& desc,
- id<MTLTexture> renderTexture)
+ id<MTLTexture> renderTexture,
+ Wrapped)
: GrSurface(gpu, desc)
, GrRenderTarget(gpu, desc)
, fRenderTexture(renderTexture)
, fResolveTexture(nil) {
SkASSERT(1 == desc.fSampleCnt);
- this->registerWithCache(budgeted);
+ this->registerWithCacheWrapped(GrWrapCacheable::kNo);
}
+// Called by subclass constructors.
GrMtlRenderTarget::GrMtlRenderTarget(GrMtlGpu* gpu,
const GrSurfaceDesc& desc,
id<MTLTexture> renderTexture)
@@ -38,8 +40,7 @@
SkASSERT(nil != renderTexture);
SkASSERT(1 == renderTexture.mipmapLevelCount);
SkASSERT(MTLTextureUsageRenderTarget & renderTexture.usage);
- return sk_sp<GrMtlRenderTarget>(new GrMtlRenderTarget(gpu, SkBudgeted::kNo,
- desc, renderTexture));
+ return sk_sp<GrMtlRenderTarget>(new GrMtlRenderTarget(gpu, desc, renderTexture, kWrapped));
}
GrMtlRenderTarget::~GrMtlRenderTarget() {
@@ -47,7 +48,6 @@
SkASSERT(nil == fResolveTexture);
}
-
GrBackendRenderTarget GrMtlRenderTarget::getBackendRenderTarget() const {
GrMtlTextureInfo info;
info.fTexture = GrGetPtrFromId(fRenderTexture);