Remove SkSurface::MakeFromBackendTextureAsRenderTarget
Bug: skia:9832
Change-Id: I4cb6f8abdb58ac37e9304a4c484e6cac4a25f0d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324890
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index 9792191..5d53db5 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -249,17 +249,6 @@
RenderTargetReleaseProc releaseProc = nullptr,
ReleaseContext releaseContext = nullptr);
-#if GR_TEST_UTILS
- // TODO: Remove this.
- static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrRecordingContext* context,
- const GrBackendTexture& backendTexture,
- GrSurfaceOrigin origin,
- int sampleCnt,
- SkColorType colorType,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* surfaceProps);
-#endif
-
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
/** Private.
Creates SkSurface from Android hardware buffer.
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 6dc2d8f..68ee32f 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -337,28 +337,6 @@
return rt;
}
-sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTexture& backendTex,
- int sampleCnt) {
- this->handleDirtyContext();
-
- const GrCaps* caps = this->caps();
-
- int maxSize = caps->maxTextureSize();
- if (backendTex.width() > maxSize || backendTex.height() > maxSize) {
- return nullptr;
- }
-
- if (!caps->isFormatRenderable(backendTex.getBackendFormat(), sampleCnt)) {
- return nullptr;
- }
-
- auto rt = this->onWrapBackendTextureAsRenderTarget(backendTex, sampleCnt);
- if (rt && sampleCnt > 1 && !this->caps()->msaaResolvesAutomatically()) {
- rt->setRequiresManualMSAAResolve();
- }
- return rt;
-}
-
sk_sp<GrRenderTarget> GrGpu::wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo& imageInfo,
const GrVkDrawableInfo& vkInfo) {
return this->onWrapVulkanSecondaryCBAsRenderTarget(imageInfo, vkInfo);
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index b6aa43c..6960f43 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -175,11 +175,6 @@
sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTarget&);
/**
- * Implements GrResourceProvider::wrapBackendTextureAsRenderTarget
- */
- sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTexture&, int sampleCnt);
-
- /**
* Implements GrResourceProvider::wrapVulkanSecondaryCBAsRenderTarget
*/
sk_sp<GrRenderTarget> wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
@@ -806,8 +801,6 @@
GrWrapOwnership,
GrWrapCacheable) = 0;
virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) = 0;
- virtual sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) = 0;
virtual sk_sp<GrRenderTarget> onWrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
const GrVkDrawableInfo&);
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 87c766b..9f50bbc 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -630,33 +630,6 @@
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(std::move(rt), UseAllocator::kNo));
}
-sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget(
- const GrBackendTexture& backendTex, int sampleCnt) {
- if (this->isAbandoned()) {
- return nullptr;
- }
-
- // This is only supported on a direct GrContext.
- auto direct = fImageContext->asDirectContext();
- if (!direct) {
- return nullptr;
- }
-
- GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
-
- sk_sp<GrRenderTarget> rt =
- resourceProvider->wrapBackendTextureAsRenderTarget(backendTex, sampleCnt);
- if (!rt) {
- return nullptr;
- }
- SkASSERT(!rt->asTexture()); // A GrRenderTarget that's not textureable
- SkASSERT(!rt->getUniqueKey().isValid());
- // This proxy should be unbudgeted because we're just wrapping an external resource
- SkASSERT(GrBudgetedType::kBudgeted != rt->resourcePriv().budgetedType());
-
- return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), UseAllocator::kNo));
-}
-
sk_sp<GrRenderTargetProxy> GrProxyProvider::wrapVulkanSecondaryCBAsRenderTarget(
const SkImageInfo& imageInfo, const GrVkDrawableInfo& vkInfo) {
if (this->isAbandoned()) {
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index 73e3c56..336a3d8 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -137,11 +137,6 @@
sk_sp<GrSurfaceProxy> wrapBackendRenderTarget(const GrBackendRenderTarget&,
sk_sp<GrRefCntedCallback> releaseHelper);
- /*
- * Create a render target proxy that wraps a backend texture
- */
- sk_sp<GrSurfaceProxy> wrapBackendTextureAsRenderTarget(const GrBackendTexture&, int sampleCnt);
-
sk_sp<GrRenderTargetProxy> wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
const GrVkDrawableInfo&);
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index c8f0c91..8b1b190 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -256,25 +256,6 @@
origin, surfaceProps);
}
-std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendTextureAsRenderTarget(
- GrRecordingContext* context,
- GrColorType colorType,
- sk_sp<SkColorSpace> colorSpace,
- const GrBackendTexture& tex,
- int sampleCnt,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps) {
- SkASSERT(sampleCnt > 0);
- sk_sp<GrSurfaceProxy> proxy(
- context->priv().proxyProvider()->wrapBackendTextureAsRenderTarget(tex, sampleCnt));
- if (!proxy) {
- return nullptr;
- }
-
- return GrRenderTargetContext::Make(context, colorType, std::move(colorSpace), std::move(proxy),
- origin, surfaceProps);
-}
-
std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeFromBackendRenderTarget(
GrRecordingContext* context,
GrColorType colorType,
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index c4494ae..ac40a45 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -123,10 +123,6 @@
int sampleCnt, GrSurfaceOrigin, const SkSurfaceProps*,
sk_sp<GrRefCntedCallback> releaseHelper);
- static std::unique_ptr<GrRenderTargetContext> MakeFromBackendTextureAsRenderTarget(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, const GrBackendTexture&,
- int sampleCnt, GrSurfaceOrigin, const SkSurfaceProps*);
-
static std::unique_ptr<GrRenderTargetContext> MakeFromBackendRenderTarget(
GrRecordingContext*,
GrColorType,
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 93d91af..f05dcf2 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -526,14 +526,6 @@
return false;
}
-sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendTextureAsRenderTarget(
- const GrBackendTexture& tex, int sampleCnt) {
- if (this->isAbandoned()) {
- return nullptr;
- }
- return fGpu->wrapBackendTextureAsRenderTarget(tex, sampleCnt);
-}
-
std::unique_ptr<GrSemaphore> SK_WARN_UNUSED_RESULT GrResourceProvider::makeSemaphore(
bool isOwned) {
return this->isAbandoned() ? nullptr : fGpu->makeSemaphore(isOwned);
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index e952c2e..0a2143c 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -263,17 +263,6 @@
*/
bool attachStencilAttachment(GrRenderTarget* rt, int numStencilSamples);
- /**
- * Wraps an existing texture with a GrRenderTarget object. This is useful when the provided
- * texture has a format that cannot be textured from by Skia, but we want to raster to it.
- *
- * The texture is wrapped as borrowed. The texture object will not be freed once the
- * render target is destroyed.
- *
- * @return GrRenderTarget object or NULL on failure.
- */
- sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTexture&, int sampleCnt);
-
/**
* Assigns a unique key to a resource. If the key is associated with another resource that
* association is removed and replaced by this resource.
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index be57b55..e023774 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -95,9 +95,9 @@
// multisampled-render-to-texture extension.
//
// NOTE: This is the only instance where we need to set the manual resolve flag on a proxy.
- // Any other proxies that require manual resolve (e.g., wrapBackendTextureAsRenderTarget())
- // will be wrapped, and the wrapped version of the GrSurface constructor will automatically
- // get the manual resolve flag when copying the target GrSurface's flags.
+ // Any other proxies that require manual resolve (e.g., wrapRenderableBackendTexture() with
+ // a sample count) will be wrapped, and the wrapped version of the GrSurface constructor
+ // will automatically get the manual resolve flag when copying the target GrSurface's flags.
fSurfaceFlags |= GrInternalSurfaceFlags::kRequiresManualMSAAResolve;
}
}
diff --git a/src/gpu/d3d/GrD3DGpu.cpp b/src/gpu/d3d/GrD3DGpu.cpp
index b3f22b9..b138b2d 100644
--- a/src/gpu/d3d/GrD3DGpu.cpp
+++ b/src/gpu/d3d/GrD3DGpu.cpp
@@ -918,44 +918,6 @@
return std::move(tgt);
}
-sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
- int sampleCnt) {
-
- GrD3DTextureResourceInfo textureInfo;
- if (!tex.getD3DTextureResourceInfo(&textureInfo)) {
- return nullptr;
- }
- if (!check_resource_info(textureInfo)) {
- return nullptr;
- }
-
- // If sampleCnt is > 1 we will create an intermediate MSAA VkImage and then resolve into
- // the wrapped VkImage. We don't yet support rendering directly to client-provided MSAA texture.
- if (textureInfo.fSampleCount != 1) {
- return nullptr;
- }
-
- if (!check_rt_resource_info(this->d3dCaps(), textureInfo, sampleCnt)) {
- return nullptr;
- }
-
- // TODO: support protected context
- if (tex.isProtected()) {
- return nullptr;
- }
-
- sampleCnt = this->d3dCaps().getRenderTargetSampleCount(sampleCnt, textureInfo.fFormat);
- if (!sampleCnt) {
- return nullptr;
- }
-
- sk_sp<GrD3DResourceState> state = tex.getGrD3DResourceState();
- SkASSERT(state);
-
- return GrD3DRenderTarget::MakeWrappedRenderTarget(this, tex.dimensions(), sampleCnt,
- textureInfo, std::move(state));
-}
-
sk_sp<GrGpuBuffer> GrD3DGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type,
GrAccessPattern accessPattern, const void* data) {
sk_sp<GrD3DBuffer> buffer = GrD3DBuffer::Make(this, sizeInBytes, type, accessPattern);
diff --git a/src/gpu/d3d/GrD3DGpu.h b/src/gpu/d3d/GrD3DGpu.h
index 58a656f..4903fb1 100644
--- a/src/gpu/d3d/GrD3DGpu.h
+++ b/src/gpu/d3d/GrD3DGpu.h
@@ -169,9 +169,6 @@
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) override;
-
sk_sp<GrGpuBuffer> onCreateBuffer(size_t sizeInBytes, GrGpuBufferType, GrAccessPattern,
const void*) override;
diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp
index bb1d3ad..ab54c45 100644
--- a/src/gpu/dawn/GrDawnGpu.cpp
+++ b/src/gpu/dawn/GrDawnGpu.cpp
@@ -289,23 +289,6 @@
return GrDawnRenderTarget::MakeWrapped(this, dimensions, sampleCnt, info);
}
-sk_sp<GrRenderTarget> GrDawnGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
- int sampleCnt) {
- GrDawnTextureInfo textureInfo;
- if (!tex.getDawnTextureInfo(&textureInfo) || !textureInfo.fTexture) {
- return nullptr;
- }
-
- SkISize dimensions = { tex.width(), tex.height() };
- sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, tex.getBackendFormat());
- if (sampleCnt < 1) {
- return nullptr;
- }
-
- GrDawnRenderTargetInfo info(textureInfo);
- return GrDawnRenderTarget::MakeWrapped(this, dimensions, sampleCnt, info);
-}
-
sk_sp<GrAttachment> GrDawnGpu::makeStencilAttachmentForRenderTarget(const GrRenderTarget* rt,
SkISize dimensions,
int numStencilSamples) {
diff --git a/src/gpu/dawn/GrDawnGpu.h b/src/gpu/dawn/GrDawnGpu.h
index e6acb7f..efc01f9 100644
--- a/src/gpu/dawn/GrDawnGpu.h
+++ b/src/gpu/dawn/GrDawnGpu.h
@@ -146,9 +146,6 @@
GrWrapCacheable) override;
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) override;
-
GrBackendTexture onCreateBackendTexture(SkISize dimensions,
const GrBackendFormat&,
GrRenderable,
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 338a5d357..ad59a97 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -801,27 +801,6 @@
backendRT.stencilBits());
}
-sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
- int sampleCnt) {
- GrGLTexture::Desc desc;
- // We do not check whether texture rectangle is supported by Skia - if the caller provided us
- // with a texture rectangle,we assume the necessary support exists.
- if (!check_backend_texture(tex, this->glCaps(), &desc, true)) {
- return nullptr;
- }
-
- if (!this->glCaps().isFormatRenderable(desc.fFormat, sampleCnt)) {
- return nullptr;
- }
-
- const int sampleCount = this->glCaps().getRenderTargetSampleCount(sampleCnt, desc.fFormat);
- GrGLRenderTarget::IDs rtIDs;
- if (!this->createRenderTargetObjects(desc, sampleCount, &rtIDs)) {
- return nullptr;
- }
- return GrGLRenderTarget::MakeWrapped(this, desc.fSize, desc.fFormat, sampleCount, rtIDs, 0);
-}
-
static bool check_write_and_transfer_input(GrGLTexture* glTex) {
if (!glTex) {
return false;
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index e930f44..c056ee8 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -255,8 +255,6 @@
GrWrapOwnership,
GrWrapCacheable) override;
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) override;
// Given a GL format return the index into the stencil format array on GrGLCaps to a
// compatible stencil format, or negative if there is no compatible stencil format.
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index 1839930..7fbfa78 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -250,20 +250,6 @@
isProtected, info));
}
-sk_sp<GrRenderTarget> GrMockGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
- int sampleCnt) {
- GrMockTextureInfo texInfo;
- SkAssertResult(tex.getMockTextureInfo(&texInfo));
- SkASSERT(texInfo.compressionType() == SkImage::CompressionType::kNone);
-
- // The client gave us the texture ID but we supply the render target ID.
- GrMockRenderTargetInfo rtInfo(texInfo.colorType(), NextInternalRenderTargetID());
-
- auto isProtected = GrProtected(tex.isProtected());
- return sk_sp<GrRenderTarget>(new GrMockRenderTarget(
- this, GrMockRenderTarget::kWrapped, tex.dimensions(), sampleCnt, isProtected, rtInfo));
-}
-
sk_sp<GrGpuBuffer> GrMockGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type,
GrAccessPattern accessPattern, const void*) {
return sk_sp<GrGpuBuffer>(new GrMockBuffer(this, sizeInBytes, type, accessPattern));
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index 0153110..d3c1b0f 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -96,9 +96,6 @@
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) override;
-
sk_sp<GrGpuBuffer> onCreateBuffer(size_t sizeInBytes, GrGpuBufferType, GrAccessPattern,
const void*) override;
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 2478321..0c9fdd4 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -189,9 +189,6 @@
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) override;
-
sk_sp<GrGpuBuffer> onCreateBuffer(size_t, GrGpuBufferType, GrAccessPattern,
const void*) override;
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 7af0dbf..65ae27b 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -782,31 +782,6 @@
backendRT.sampleCnt(), mtlTexture);
}
-sk_sp<GrRenderTarget> GrMtlGpu::onWrapBackendTextureAsRenderTarget(
- const GrBackendTexture& backendTex, int sampleCnt) {
- id<MTLTexture> mtlTexture = get_texture_from_backend(backendTex);
- if (!mtlTexture) {
- return nullptr;
- }
-
- MTLPixelFormat format = mtlTexture.pixelFormat;
- if (!this->mtlCaps().isFormatRenderable(format, sampleCnt)) {
- return nullptr;
- }
-
- if (@available(macOS 10.11, iOS 9.0, *)) {
- SkASSERT(MTLTextureUsageRenderTarget & mtlTexture.usage);
- }
-
- sampleCnt = this->mtlCaps().getRenderTargetSampleCount(sampleCnt, format);
- if (!sampleCnt) {
- return nullptr;
- }
-
- return GrMtlRenderTarget::MakeWrappedRenderTarget(this, backendTex.dimensions(), sampleCnt,
- mtlTexture);
-}
-
bool GrMtlGpu::onRegenerateMipMapLevels(GrTexture* texture) {
GrMtlTexture* grMtlTexture = static_cast<GrMtlTexture*>(texture);
id<MTLTexture> mtlTexture = grMtlTexture->mtlTexture();
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 892e7a0..fa9f3ec 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1393,43 +1393,6 @@
return std::move(tgt);
}
-sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
- int sampleCnt) {
- GrVkImageInfo imageInfo;
- if (!tex.getVkImageInfo(&imageInfo)) {
- return nullptr;
- }
- if (!check_image_info(this->vkCaps(), imageInfo, false, this->queueIndex())) {
- return nullptr;
- }
- // See comment below about intermediate MSAA buffer.
- if (imageInfo.fSampleCount != 1) {
- return nullptr;
- }
-
- // If sampleCnt is > 1 we will create an intermediate MSAA VkImage and then resolve into
- // the wrapped VkImage.
- bool resolveOnly = sampleCnt > 1;
- if (!check_rt_image_info(this->vkCaps(), imageInfo, resolveOnly)) {
- return nullptr;
- }
-
- if (tex.isProtected() && (fProtectedContext == GrProtected::kNo)) {
- return nullptr;
- }
-
- sampleCnt = this->vkCaps().getRenderTargetSampleCount(sampleCnt, imageInfo.fFormat);
- if (!sampleCnt) {
- return nullptr;
- }
-
- sk_sp<GrBackendSurfaceMutableStateImpl> mutableState = tex.getMutableState();
- SkASSERT(mutableState);
-
- return GrVkRenderTarget::MakeWrappedRenderTarget(this, tex.dimensions(), sampleCnt, imageInfo,
- std::move(mutableState));
-}
-
sk_sp<GrRenderTarget> GrVkGpu::onWrapVulkanSecondaryCBAsRenderTarget(
const SkImageInfo& imageInfo, const GrVkDrawableInfo& vkInfo) {
int maxSize = this->caps()->maxTextureSize();
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 7e45798..57b9669 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -253,9 +253,6 @@
GrWrapCacheable) override;
sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&) override;
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
- int sampleCnt) override;
-
sk_sp<GrRenderTarget> onWrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
const GrVkDrawableInfo&) override;
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index a61ed0c..da5e26e 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -641,42 +641,6 @@
return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
-#if GR_TEST_UTILS
-sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrRecordingContext* context,
- const GrBackendTexture& tex,
- GrSurfaceOrigin origin,
- int sampleCnt,
- SkColorType colorType,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props) {
- if (!context) {
- return nullptr;
- }
-
- sampleCnt = std::max(1, sampleCnt);
- GrColorType grColorType = SkColorTypeAndFormatToGrColorType(context->priv().caps(), colorType,
- tex.getBackendFormat());
- if (grColorType == GrColorType::kUnknown) {
- return nullptr;
- }
- if (!validate_backend_texture(context->priv().caps(), tex, sampleCnt, grColorType, false)) {
- return nullptr;
- }
-
- auto rtc = GrRenderTargetContext::MakeFromBackendTextureAsRenderTarget(
- context, grColorType, std::move(colorSpace), tex, sampleCnt, origin, props);
- if (!rtc) {
- return nullptr;
- }
-
- auto device = SkGpuDevice::Make(context, std::move(rtc), SkGpuDevice::kUninit_InitContents);
- if (!device) {
- return nullptr;
- }
- return sk_make_sp<SkSurface_Gpu>(std::move(device));
-}
-#endif
-
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrDirectContext* dContext,
AHardwareBuffer* hardwareBuffer,
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index ff88d68..0c1f72a 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -263,27 +263,6 @@
}
#endif
- // Tests wrapBackendRenderTarget with a GrBackendTexture
- {
- GrBackendTexture backendTex;
- CreateBackendTexture(direct, &backendTex, kWidthHeight, kWidthHeight, colorType,
- SkColors::kTransparent, GrMipmapped::kNo, GrRenderable::kYes,
- GrProtected::kNo);
- sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
- backendTex, supportedNumSamples);
- if (!sProxy) {
- direct->deleteBackendTexture(backendTex);
- continue; // This can fail on Mesa
- }
-
- check_surface(reporter, sProxy.get(), kWidthHeight, kWidthHeight, SkBudgeted::kNo);
- check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
- supportedNumSamples, SkBackingFit::kExact,
- caps.maxWindowRectangles());
-
- direct->deleteBackendTexture(backendTex);
- }
-
// Tests wrapBackendTexture that is only renderable
{
GrBackendTexture backendTex;