aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-05-03 16:54:03 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-10 14:44:55 +0000
commitccd4cfc23ebbbecbc6b292359352aad335ad7b73 (patch)
tree88940d88f16be8fe4bd943e0264b4c9f4b531ad7 /src
parentf77db110e1c4d2b813ed40de0cf63f65f84b4b64 (diff)
Remove GrBackendObject and all related functions from Skia.
Bug: skia: Change-Id: I59434b7477c0bc26fd982bd81eb97ab94bbba073 Reviewed-on: https://skia-review.googlesource.com/125822 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGLRenderTarget.h4
-rw-r--r--src/gpu/gl/GrGLTexture.cpp6
-rw-r--r--src/gpu/gl/GrGLTexture.h3
-rw-r--r--src/gpu/mock/GrMockTexture.h15
-rw-r--r--src/gpu/mtl/GrMtlRenderTarget.h4
-rw-r--r--src/gpu/mtl/GrMtlRenderTarget.mm7
-rw-r--r--src/gpu/mtl/GrMtlTexture.h3
-rw-r--r--src/gpu/mtl/GrMtlTexture.mm7
-rw-r--r--src/gpu/vk/GrVkImage.h25
-rw-r--r--src/gpu/vk/GrVkRenderTarget.cpp9
-rw-r--r--src/gpu/vk/GrVkRenderTarget.h4
-rw-r--r--src/gpu/vk/GrVkTexture.cpp6
-rw-r--r--src/gpu/vk/GrVkTexture.h3
-rw-r--r--src/image/SkImage.cpp11
-rw-r--r--src/image/SkImage_Base.h6
-rw-r--r--src/image/SkImage_Gpu.cpp40
-rw-r--r--src/image/SkImage_Gpu.h4
-rw-r--r--src/image/SkSurface.cpp10
-rw-r--r--src/image/SkSurface_Base.h10
-rw-r--r--src/image/SkSurface_Gpu.cpp23
-rw-r--r--src/image/SkSurface_Gpu.h5
21 files changed, 0 insertions, 205 deletions
diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
index 4412dcf425..a9ec3c385c 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -61,10 +61,6 @@ public:
}
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; }
-#endif
-
GrBackendRenderTarget getBackendRenderTarget() const override;
bool canAttemptStencilAttachment() const override;
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index bf22bdb751..2d674f4756 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -97,12 +97,6 @@ void GrGLTexture::onAbandon() {
INHERITED::onAbandon();
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject GrGLTexture::getTextureHandle() const {
- return reinterpret_cast<GrBackendObject>(&fInfo);
-}
-#endif
-
GrBackendTexture GrGLTexture::getBackendTexture() const {
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(), fInfo);
}
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index fcc85bc700..67eab4312e 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -39,9 +39,6 @@ public:
SkASSERT(!fReleaseHelper);
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getTextureHandle() const override;
-#endif
GrBackendTexture getBackendTexture() const override;
void textureParamsModified() override { fTexParams.invalidate(); }
diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h
index 071b4f4615..24ef009229 100644
--- a/src/gpu/mock/GrMockTexture.h
+++ b/src/gpu/mock/GrMockTexture.h
@@ -31,11 +31,6 @@ public:
~GrMockTexture() override {}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getTextureHandle() const override {
- return reinterpret_cast<GrBackendObject>(&fInfo);
- }
-#endif
GrBackendTexture getBackendTexture() const override {
return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(),
fInfo);
@@ -120,12 +115,6 @@ public:
return {this->width(), this->height(), this->numColorSamples(), numStencilBits, fInfo};
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getRenderTargetHandle() const override {
- return reinterpret_cast<GrBackendObject>(&fInfo);
- }
-#endif
-
protected:
// constructor for subclasses
GrMockRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc,
@@ -160,10 +149,6 @@ public:
this->registerWithCacheWrapped();
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getRenderTargetHandle() const override { return 0; }
-#endif
-
GrTexture* asTexture() override { return this; }
GrRenderTarget* asRenderTarget() override { return this; }
const GrTexture* asTexture() const override { return this; }
diff --git a/src/gpu/mtl/GrMtlRenderTarget.h b/src/gpu/mtl/GrMtlRenderTarget.h
index c653952482..c0f0cf57e1 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.h
+++ b/src/gpu/mtl/GrMtlRenderTarget.h
@@ -40,10 +40,6 @@ public:
return true;
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getRenderTargetHandle() const override;
-#endif
-
GrBackendRenderTarget getBackendRenderTarget() const override {
return GrBackendRenderTarget(); // invalid
}
diff --git a/src/gpu/mtl/GrMtlRenderTarget.mm b/src/gpu/mtl/GrMtlRenderTarget.mm
index c8060cf88c..c102e6dcfc 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.mm
+++ b/src/gpu/mtl/GrMtlRenderTarget.mm
@@ -63,13 +63,6 @@ GrMtlGpu* GrMtlRenderTarget::getMtlGpu() const {
return static_cast<GrMtlGpu*>(this->getGpu());
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject GrMtlRenderTarget::getRenderTargetHandle() const {
- void* voidRT = (__bridge_retained void*)fRenderTexture;
- return (GrBackendObject)voidRT;
-}
-#endif
-
void GrMtlRenderTarget::onAbandon() {
fRenderTexture = nil;
fResolveTexture = nil;
diff --git a/src/gpu/mtl/GrMtlTexture.h b/src/gpu/mtl/GrMtlTexture.h
index 21f5e13b19..f75083272a 100644
--- a/src/gpu/mtl/GrMtlTexture.h
+++ b/src/gpu/mtl/GrMtlTexture.h
@@ -26,9 +26,6 @@ public:
id<MTLTexture> mtlTexture() const { return fTexture; }
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getTextureHandle() const override;
-#endif
GrBackendTexture getBackendTexture() const override;
void textureParamsModified() override {}
diff --git a/src/gpu/mtl/GrMtlTexture.mm b/src/gpu/mtl/GrMtlTexture.mm
index 534eb6baf7..e029836b60 100644
--- a/src/gpu/mtl/GrMtlTexture.mm
+++ b/src/gpu/mtl/GrMtlTexture.mm
@@ -71,13 +71,6 @@ GrMtlGpu* GrMtlTexture::getMtlGpu() const {
return static_cast<GrMtlGpu*>(this->getGpu());
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject GrMtlTexture::getTextureHandle() const {
- void* voidTex = (__bridge_retained void*)fTexture;
- return (GrBackendObject)voidTex;
-}
-#endif
-
GrBackendTexture GrMtlTexture::getBackendTexture() const {
return GrBackendTexture(); // invalid
}
diff --git a/src/gpu/vk/GrVkImage.h b/src/gpu/vk/GrVkImage.h
index 9e99743fe7..038b0ee86d 100644
--- a/src/gpu/vk/GrVkImage.h
+++ b/src/gpu/vk/GrVkImage.h
@@ -30,7 +30,6 @@ public:
, fLayout(std::move(layout))
, fIsBorrowed(GrBackendObjectOwnership::kBorrowed == ownership) {
SkASSERT(fLayout->getImageLayout() == fInfo.fImageLayout);
- fTempLayoutTracker = fLayout->getImageLayout();
if (fIsBorrowed) {
fResource = new BorrowedResource(info.fImage, info.fAlloc, info.fImageTiling);
} else {
@@ -52,23 +51,6 @@ public:
sk_sp<GrVkImageLayout> grVkImageLayout() const { return fLayout; }
VkImageLayout currentLayout() const {
- // This check and set is temporary since clients can still change the layout using
- // the old GrBackendObject call and we need a way to respect those changes. This only works
- // if the client isn't using GrBackendObjects and GrBackendTextures to update the layout
- // at the same time. This check and set should all be made atomic but the plan is to remove
- // the use of fInfo.fImageLayout so ignoring this issue for now.
- // TODO: Delete all this ugliness as soon as we get rid of GrBackendObject getters.
- if (fInfo.fImageLayout != fLayout->getImageLayout()) {
- if (fLayout->getImageLayout() == fTempLayoutTracker) {
- fLayout->setImageLayout(fInfo.fImageLayout);
- } else {
- SkASSERT(fInfo.fImageLayout == fTempLayoutTracker);
- *const_cast<VkImageLayout*>(&fInfo.fImageLayout) = fLayout->getImageLayout();
- }
- *const_cast<VkImageLayout*>(&fTempLayoutTracker) = fLayout->getImageLayout();
- }
- SkASSERT(fInfo.fImageLayout == fTempLayoutTracker &&
- fLayout->getImageLayout() == fTempLayoutTracker);
return fLayout->getImageLayout();
}
@@ -83,8 +65,6 @@ public:
// blit each layer, and then at the end need to update our tracking.
void updateImageLayout(VkImageLayout newLayout) {
fLayout->setImageLayout(newLayout);
- fInfo.fImageLayout = newLayout;
- fTempLayoutTracker = newLayout;
}
struct ImageDesc {
@@ -128,11 +108,6 @@ protected:
GrVkImageInfo fInfo;
sk_sp<GrVkImageLayout> fLayout;
- // This is used while we still have GrBackendObjects around that are able to change our image
- // layout without using the ref count method. This helps us determine which value has gotten out
- // of sync.
- // TODO: Delete this when get rid of a GrBackendObject getters
- VkImageLayout fTempLayoutTracker;
bool fIsBorrowed;
private:
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp
index 3cab94d7dc..9ca8a98928 100644
--- a/src/gpu/vk/GrVkRenderTarget.cpp
+++ b/src/gpu/vk/GrVkRenderTarget.cpp
@@ -352,15 +352,6 @@ void GrVkRenderTarget::onAbandon() {
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject GrVkRenderTarget::getRenderTargetHandle() const {
- // If the render target is multisampled, we currently return the ImageInfo for the resolved
- // image. If we only wrap the msaa target (currently not implemented) we should return a handle
- // to that instead.
- return (GrBackendObject)&fInfo;
-}
-#endif
-
GrBackendRenderTarget GrVkRenderTarget::getBackendRenderTarget() const {
return GrBackendRenderTarget(this->width(), this->height(), this->numColorSamples(),
fInfo, this->grVkImageLayout());
diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h
index ed840fc226..de2317ef06 100644
--- a/src/gpu/vk/GrVkRenderTarget.h
+++ b/src/gpu/vk/GrVkRenderTarget.h
@@ -70,10 +70,6 @@ public:
return true;
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getRenderTargetHandle() const override;
-#endif
-
GrBackendRenderTarget getBackendRenderTarget() const override;
void getAttachmentsDescriptor(GrVkRenderPass::AttachmentsDescriptor* desc,
diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp
index c4393fdd36..116b37eddd 100644
--- a/src/gpu/vk/GrVkTexture.cpp
+++ b/src/gpu/vk/GrVkTexture.cpp
@@ -161,12 +161,6 @@ void GrVkTexture::onAbandon() {
INHERITED::onAbandon();
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject GrVkTexture::getTextureHandle() const {
- return (GrBackendObject)&fInfo;
-}
-#endif
-
GrBackendTexture GrVkTexture::getBackendTexture() const {
return GrBackendTexture(this->width(), this->height(), fInfo, this->grVkImageLayout());
}
diff --git a/src/gpu/vk/GrVkTexture.h b/src/gpu/vk/GrVkTexture.h
index 79506eff9e..55239e3903 100644
--- a/src/gpu/vk/GrVkTexture.h
+++ b/src/gpu/vk/GrVkTexture.h
@@ -29,9 +29,6 @@ public:
~GrVkTexture() override;
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject getTextureHandle() const override;
-#endif
GrBackendTexture getBackendTexture() const override;
void textureParamsModified() override {}
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 3be804fca8..72285bd698 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -163,13 +163,6 @@ GrTexture* SkImage::getTexture() const {
bool SkImage::isTextureBacked() const { return SkToBool(as_IB(this)->peekProxy()); }
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject SkImage::getTextureHandle(bool flushPendingGrContextIO,
- GrSurfaceOrigin* origin) const {
- return as_IB(this)->onGetTextureHandle(flushPendingGrContextIO, origin);
-}
-#endif
-
GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const {
return as_IB(this)->onGetBackendTexture(flushPendingGrContextIO, origin);
@@ -188,10 +181,6 @@ GrTexture* SkImage::getTexture() const { return nullptr; }
bool SkImage::isTextureBacked() const { return false; }
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject SkImage::getTextureHandle(bool, GrSurfaceOrigin*) const { return 0; }
-#endif
-
GrBackendTexture SkImage::getBackendTexture(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const {
return GrBackendTexture(); // invalid
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index c74a7b97e0..9cf70fb1d3 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -55,12 +55,6 @@ public:
virtual sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const {
return nullptr;
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- virtual GrBackendObject onGetTextureHandle(bool flushPendingGrContextIO,
- GrSurfaceOrigin* origin) const {
- return 0;
- }
-#endif
virtual GrTexture* onGetTexture() const { return nullptr; }
#endif
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 17a0a25f5a..08c9010228 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -162,46 +162,6 @@ static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes)
}
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject SkImage_Gpu::onGetTextureHandle(bool flushPendingGrContextIO,
- GrSurfaceOrigin* origin) const {
- SkASSERT(fProxy);
-
- if (!fContext->contextPriv().resourceProvider() && !fProxy->priv().isInstantiated()) {
- // This image was created with a DDL context and cannot be instantiated. Thus we return 0
- // here which is considered invalid for all backends.
- return 0;
- }
-
- if (GrSurfaceProxy::LazyState::kNot != fProxy->lazyInstantiationState()) {
- SkASSERT(fContext->contextPriv().resourceProvider());
- fProxy->priv().doLazyInstantiation(fContext->contextPriv().resourceProvider());
- if (!fProxy->priv().isInstantiated()) {
- // We failed to instantiate the lazy proxy. Thus we return 0 here which is considered
- // invalid for all backends.
- return 0;
- }
- }
-
- if (!fProxy->instantiate(fContext->contextPriv().resourceProvider())) {
- return 0;
- }
-
- GrTexture* texture = fProxy->priv().peekTexture();
-
- if (texture) {
- if (flushPendingGrContextIO) {
- fContext->contextPriv().prepareSurfaceForExternalIO(fProxy.get());
- }
- if (origin) {
- *origin = fProxy->origin();
- }
- return texture->getTextureHandle();
- }
- return 0;
-}
-#endif
-
GrBackendTexture SkImage_Gpu::onGetBackendTexture(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const {
SkASSERT(fProxy);
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 1425c875ce..cb9a7c7a9f 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -50,10 +50,6 @@ public:
return fProxy;
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject onGetTextureHandle(bool flushPendingGrContextIO,
- GrSurfaceOrigin* origin) const override;
-#endif
GrBackendTexture onGetBackendTexture(bool flushPendingGrContextIO,
GrSurfaceOrigin* origin) const override;
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index 73f3175ab9..1a3eb4312e 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -218,16 +218,6 @@ void SkSurface::writePixels(const SkBitmap& src, int x, int y) {
}
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject SkSurface::getTextureHandle(BackendHandleAccess access) {
- return asSB(this)->onGetTextureHandle(access);
-}
-
-bool SkSurface::getRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) {
- return asSB(this)->onGetRenderTargetHandle(obj, access);
-}
-#endif
-
GrBackendTexture SkSurface::getBackendTexture(BackendHandleAccess access) {
return asSB(this)->onGetBackendTexture(access);
}
diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h
index 90bcdff1dd..67d330f9bb 100644
--- a/src/image/SkSurface_Base.h
+++ b/src/image/SkSurface_Base.h
@@ -19,16 +19,6 @@ public:
SkSurface_Base(const SkImageInfo&, const SkSurfaceProps*);
virtual ~SkSurface_Base();
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- virtual GrBackendObject onGetTextureHandle(BackendHandleAccess) {
- return 0;
- }
-
- virtual bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) {
- return false;
- }
-#endif
-
virtual GrBackendTexture onGetBackendTexture(BackendHandleAccess);
virtual GrBackendRenderTarget onGetBackendRenderTarget(BackendHandleAccess);
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index b47cfbcf7a..b646f9e506 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -52,29 +52,6 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
return rtc->accessRenderTarget();
}
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
-GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) {
- GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
- if (!rt) {
- return 0;
- }
- GrTexture* texture = rt->asTexture();
- if (texture) {
- return texture->getTextureHandle();
- }
- return 0;
-}
-
-bool SkSurface_Gpu::onGetRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) {
- GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
- if (!rt) {
- return false;
- }
- *obj = rt->getRenderTargetHandle();
- return true;
-}
-#endif
-
GrBackendTexture SkSurface_Gpu::onGetBackendTexture(BackendHandleAccess access) {
GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
if (!rt) {
diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h
index fc014c2cd2..97fe5e5d5a 100644
--- a/src/image/SkSurface_Gpu.h
+++ b/src/image/SkSurface_Gpu.h
@@ -23,11 +23,6 @@ public:
// This is an internal-only factory
static sk_sp<SkSurface> MakeWrappedRenderTarget(GrContext*, sk_sp<GrRenderTargetContext>);
-#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
- GrBackendObject onGetTextureHandle(BackendHandleAccess) override;
- bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override;
-#endif
-
GrBackendTexture onGetBackendTexture(BackendHandleAccess) override;
GrBackendRenderTarget onGetBackendRenderTarget(BackendHandleAccess) override;