Remove renderable flag from texture createLazyProxy.
Besides some tests, we always set the renderable flag to kNo for this
function. No need to keep supporting a code path we don't actually use.
Tests that use to pass in kYes here have been converted to calling
createLazyRenderTargetProxy instead.
Change-Id: I91efe6cc51fd7ba04b711509ca26f18eba2af333
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313425
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 4c03867..ee24c3d 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -178,9 +178,9 @@
return tex;
},
- backendFormat, {width, height}, GrRenderable::kNo, 1, GrMipmapped::kNo,
- GrMipmapStatus::kNotAllocated, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact,
- SkBudgeted::kNo, GrProtected(fIsProtectedContent), GrSurfaceProxy::UseAllocator::kYes);
+ backendFormat, {width, height}, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
+ GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
+ GrProtected(fIsProtectedContent), GrSurfaceProxy::UseAllocator::kYes);
GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index ac352fc..8a130be 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -200,8 +200,8 @@
// proxy.
return {std::move(tex), true, GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced};
},
- backendFormat, fBackendTexture.dimensions(), GrRenderable::kNo, 1, textureIsMipMapped,
- mipmapStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
+ backendFormat, fBackendTexture.dimensions(), textureIsMipMapped, mipmapStatus,
+ GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
if (!proxy) {
return {};
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 1017b9e..2bb1708 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -329,7 +329,7 @@
desc.fDimensions, desc.fFormat, colorType, desc.fRenderable,
desc.fSampleCnt, desc.fBudgeted, desc.fFit, desc.fProtected, mipLevel));
},
- format, dims, GrRenderable::kNo, 1, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
+ format, dims, GrMipmapped::kNo, GrMipmapStatus::kNotAllocated,
GrInternalSurfaceFlags::kNone, fit, budgeted, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
@@ -377,9 +377,8 @@
desc.fDimensions, desc.fFormat, colorType, GrRenderable::kNo, 1,
desc.fBudgeted, GrProtected::kNo, texels.get(), mipLevelCount));
},
- format, dims, GrRenderable::kNo, 1, GrMipmapped::kYes, GrMipmapStatus::kValid,
- GrInternalSurfaceFlags::kNone, SkBackingFit::kExact, budgeted, GrProtected::kNo,
- UseAllocator::kYes);
+ format, dims, GrMipmapped::kYes, GrMipmapStatus::kValid, GrInternalSurfaceFlags::kNone,
+ SkBackingFit::kExact, budgeted, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@@ -465,9 +464,8 @@
desc.fDimensions, desc.fFormat, desc.fBudgeted, desc.fMipmapped,
desc.fProtected, data.get()));
},
- format, dimensions, GrRenderable::kNo, 1, mipMapped, mipmapStatus,
- GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kYes,
- GrProtected::kNo, UseAllocator::kYes);
+ format, dimensions, mipMapped, mipmapStatus,GrInternalSurfaceFlags::kReadOnly,
+ SkBackingFit::kExact, SkBudgeted::kYes, GrProtected::kNo, UseAllocator::kYes);
if (!proxy) {
return nullptr;
@@ -696,8 +694,6 @@
sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
- GrRenderable renderable,
- int renderTargetSampleCnt,
GrMipmapped mipMapped,
GrMipmapStatus mipmapStatus,
GrInternalSurfaceFlags surfaceFlags,
@@ -721,33 +717,17 @@
return nullptr;
}
- if (renderable == GrRenderable::kYes) {
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*this->caps(),
- std::move(callback),
- format,
- dimensions,
- renderTargetSampleCnt,
- mipMapped,
- mipmapStatus,
- fit,
- budgeted,
- isProtected,
- surfaceFlags,
- useAllocator,
- this->isDDLProvider()));
- } else {
- return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
- format,
- dimensions,
- mipMapped,
- mipmapStatus,
- fit,
- budgeted,
- isProtected,
- surfaceFlags,
- useAllocator,
- this->isDDLProvider()));
- }
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(callback),
+ format,
+ dimensions,
+ mipMapped,
+ mipmapStatus,
+ fit,
+ budgeted,
+ isProtected,
+ surfaceFlags,
+ useAllocator,
+ this->isDDLProvider()));
}
sk_sp<GrRenderTargetProxy> GrProxyProvider::createLazyRenderTargetProxy(
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index a3b75cd..86e706f 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -157,9 +157,9 @@
/**
* Creates a texture proxy that will be instantiated by a user-supplied callback during flush.
- * (Stencil is not supported by this method.) The width and height must either both be greater
- * than 0 or both less than or equal to zero. A non-positive value is a signal that the width
- * and height are currently unknown.
+ * The width and height must either both be greater than 0 or both less than or equal to zero. A
+ * non-positive value is a signal that the width height are currently unknown. The texture will
+ * not be renderable.
*
* When called, the callback must be able to cleanup any resources that it captured at creation.
* It also must support being passed in a null GrResourceProvider. When this happens, the
@@ -168,8 +168,6 @@
sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&,
const GrBackendFormat&,
SkISize dimensions,
- GrRenderable,
- int renderTargetSampleCnt,
GrMipmapped,
GrMipmapStatus,
GrInternalSurfaceFlags,
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 95c4897..7461ab4 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -501,7 +501,7 @@
// We pass kReadOnly here since we should treat content of the client's texture as immutable.
// The promise API provides no way for the client to indicated that the texture is protected.
return proxyProvider->createLazyProxy(
- std::move(callback), backendFormat, {width, height}, GrRenderable::kNo, 1, mipMapped,
- mipmapStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
+ std::move(callback), backendFormat, {width, height}, mipMapped, mipmapStatus,
+ GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo,
GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes);
}