Remove abandon param from GrGpu::deleteTestingOnlyBackendTexture.
Prior to the existence of GrBackendTexture this was required to delete a backend-specific blob. Now it's a no-op.
Change-Id: Iba0e4233e4d07235626f0ae14b0f7e77c073d8c0
Reviewed-on: https://skia-review.googlesource.com/112569
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index dc518cd..e7e4ac0 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -464,11 +464,11 @@
GrMipMapped mipMapped) = 0;
/** Check a handle represents an actual texture in the backend API that has not been freed. */
virtual bool isTestingOnlyBackendTexture(const GrBackendTexture&) const = 0;
- /** If ownership of the backend texture has been transferred pass true for abandonTexture. This
- will do any necessary cleanup of the handle without freeing the texture in the backend
- API. */
- virtual void deleteTestingOnlyBackendTexture(GrBackendTexture*,
- bool abandonTexture = false) = 0;
+ /**
+ * Frees a texture created by createTestingOnlyBackendTexture(). If ownership of the backend
+ * texture has been transferred to a GrContext using adopt semantics this should not be called.
+ */
+ virtual void deleteTestingOnlyBackendTexture(GrBackendTexture*) = 0;
// width and height may be larger than rt (if underlying API allows it).
// Returns nullptr if compatible sb could not be created, otherwise the caller owns the ref on
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 97aa4ac..ea7be0e 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -4428,14 +4428,11 @@
return (GR_GL_TRUE == result);
}
-void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendTexture* tex, bool abandonTexture) {
+void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendTexture* tex) {
SkASSERT(kOpenGL_GrBackend == tex->backend());
- const GrGLTextureInfo* info = tex->getGLTextureInfo();
- if (info && !abandonTexture) {
- GrGLuint texID = info->fID;
-
- GL_CALL(DeleteTextures(1, &texID));
+ if (const auto* info = tex->getGLTextureInfo()) {
+ GL_CALL(DeleteTextures(1, &info->fID));
}
}
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index a62c715..6b19399 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -154,7 +154,7 @@
bool isRenderTarget,
GrMipMapped mipMapped) override;
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
- void deleteTestingOnlyBackendTexture(GrBackendTexture*, bool abandonTexture = false) override;
+ void deleteTestingOnlyBackendTexture(GrBackendTexture*) override;
void resetShaderCacheForTesting() const override;
diff --git a/src/gpu/mock/GrMockGpu.cpp b/src/gpu/mock/GrMockGpu.cpp
index 3a6b661..05371b4 100644
--- a/src/gpu/mock/GrMockGpu.cpp
+++ b/src/gpu/mock/GrMockGpu.cpp
@@ -113,7 +113,7 @@
return fOutstandingTestingOnlyTextureIDs.contains(info->fID);
}
-void GrMockGpu::deleteTestingOnlyBackendTexture(GrBackendTexture* tex, bool abandonTexture) {
+void GrMockGpu::deleteTestingOnlyBackendTexture(GrBackendTexture* tex) {
SkASSERT(kMock_GrBackend == tex->backend());
const GrMockTextureInfo* info = tex->getMockTextureInfo();
diff --git a/src/gpu/mock/GrMockGpu.h b/src/gpu/mock/GrMockGpu.h
index b5398e5..14cbd79 100644
--- a/src/gpu/mock/GrMockGpu.h
+++ b/src/gpu/mock/GrMockGpu.h
@@ -124,7 +124,7 @@
GrBackendTexture createTestingOnlyBackendTexture(void* pixels, int w, int h, GrPixelConfig,
bool isRT, GrMipMapped) override;
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
- void deleteTestingOnlyBackendTexture(GrBackendTexture*, bool abandonTexture = false) override;
+ void deleteTestingOnlyBackendTexture(GrBackendTexture*) override;
static int NextInternalTextureID();
static int NextExternalTextureID();
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index a48618b..fd190e2 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -144,7 +144,7 @@
return GrBackendTexture();
}
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override { return false; }
- void deleteTestingOnlyBackendTexture(GrBackendTexture*, bool abandon = false) override {}
+ void deleteTestingOnlyBackendTexture(GrBackendTexture*) override {}
sk_sp<GrMtlCaps> fMtlCaps;
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index a53432c..3a81eed 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -1536,12 +1536,10 @@
return false;
}
-void GrVkGpu::deleteTestingOnlyBackendTexture(GrBackendTexture* tex, bool abandon) {
+void GrVkGpu::deleteTestingOnlyBackendTexture(GrBackendTexture* tex) {
SkASSERT(kVulkan_GrBackend == tex->fBackend);
- const GrVkImageInfo* info = tex->getVkImageInfo();
-
- if (info && !abandon) {
+ if (const auto* info = tex->getVkImageInfo()) {
// something in the command buffer may still be using this, so force submit
this->submitCommandBuffer(kForce_SyncQueue);
GrVkImage::DestroyImageInfo(this, const_cast<GrVkImageInfo*>(info));
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 3655527..7616fcc 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -74,7 +74,7 @@
bool isRenderTarget,
GrMipMapped) override;
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
- void deleteTestingOnlyBackendTexture(GrBackendTexture*, bool abandonTexture = false) override;
+ void deleteTestingOnlyBackendTexture(GrBackendTexture*) override;
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*,
int width,