diff options
author | Greg Daniel <egdaniel@google.com> | 2018-05-03 16:54:03 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-21 18:25:38 +0000 |
commit | 6d138bf681eee54a8b4a40e5dbbd08a137ae0d93 (patch) | |
tree | 7eb05a8c09ad212fc9a693296287f2b62b2f99f8 | |
parent | be3c1d22c7d3e18cee9f1697827392e16b436df2 (diff) |
Reland "Remove GrBackendObject and all related functions from Skia."
This is a reland of ccd4cfc23ebbbecbc6b292359352aad335ad7b73
Original change's description:
> 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>
Bug: skia:
Change-Id: Ibd1b9bd04b36840d9d872e2f0970dd6bac378bc9
Reviewed-on: https://skia-review.googlesource.com/129380
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
31 files changed, 4 insertions, 323 deletions
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh index 4f2549b03a..614115cf01 100644 --- a/docs/SkImage_Reference.bmh +++ b/docs/SkImage_Reference.bmh @@ -1336,13 +1336,6 @@ drawImage(textureImage, "backEndTexture"); # ------------------------------------------------------------------------------ -#Method GrBackendObject getTextureHandle(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin = nullptr) const -#Deprecated -#Method ## - -# ------------------------------------------------------------------------------ - #Method GrBackendTexture getBackendTexture(bool flushPendingGrContextIO, GrSurfaceOrigin* origin = nullptr) const #In Property diff --git a/docs/SkSurface_Reference.bmh b/docs/SkSurface_Reference.bmh index 30a3d8fd60..b4faad3224 100644 --- a/docs/SkSurface_Reference.bmh +++ b/docs/SkSurface_Reference.bmh @@ -988,8 +988,8 @@ Caller must overwrite the entire back-end object. sk_sp<SkImage> image(gpuSurface->makeImageSnapshot()); str.printf("uniqueID=%d", image->uniqueID()); canvas->drawString(str, 20, y += 20, paint); - GrBackendObject backendObject = gpuSurface->getTextureHandle(access); - str.printf("backendObject %c= 0", backendObject != 0 ? '!' : '='); + GrBackendTexture backendTex = gpuSurface->getBackendTexture(access); + str.printf("backendTex is %svalid", backendTex.isValid() ? '' : 'not '); canvas->drawString(str, 20, y += 20, paint); } sk_sp<SkImage> image(gpuSurface->makeImageSnapshot()); @@ -1003,19 +1003,6 @@ Caller must overwrite the entire back-end object. # ------------------------------------------------------------------------------ -#Method GrBackendObject getTextureHandle(BackendHandleAccess backendHandleAccess) -#Deprecated -#Method ## - -# ------------------------------------------------------------------------------ - -#Method bool getRenderTargetHandle(GrBackendObject* backendObject, - BackendHandleAccess backendHandleAccess) -#Deprecated -#Method ## - -# ------------------------------------------------------------------------------ - #Method GrBackendTexture getBackendTexture(BackendHandleAccess backendHandleAccess) #In Property #Line # returns the GPU reference to texture ## @@ -1619,8 +1606,8 @@ and the client will still own the semaphores. context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(64, 64)); surface->flushAndSignalSemaphores(1, &semaphore); sk_sp<SkImage> image = surface->makeImageSnapshot(); - GrBackendObject backendImage = image->getTextureHandle(false); // unused - SkASSERT(backendImage); + GrBackendTexture backendTex = image->getBackendTexture(false); // unused + SkASSERT(backendTex.isValid()); const SkImageInfo childImageInfo = SkImageInfo::Make(64, 64, kRGBA_8888_SkColorType, kPremul_SkAlphaType); sk_sp<SkSurface> childSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, diff --git a/include/core/SkImage.h b/include/core/SkImage.h index afcbb89a5b..7c693900d3 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -534,21 +534,6 @@ public: */ bool isValid(GrContext* context) const; -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - /** Retrieves the back-end API handle of texture. If flushPendingGrContextIO is true, - complete deferred I/O operations. - - If origin is not nullptr, copies location of content drawn into SkImage. - - @param flushPendingGrContextIO flag to flush outstanding requests - @param origin storage for one of: kTopLeft_GrSurfaceOrigin, - kBottomLeft_GrSurfaceOrigin; or nullptr - @return back-end API texture handle, or nullptr - */ - GrBackendObject getTextureHandle(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin = nullptr) const; -#endif - /** Retrieves the backend texture. If SkImage has no backend texture, an invalid object is returned. Call GrBackendTexture::isValid to determine if the result is valid. diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index fb0a3685d7..83a59f14fb 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -428,39 +428,6 @@ public: static const BackendHandleAccess kDiscardWrite_TextureHandleAccess = kDiscardWrite_BackendHandleAccess; -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - /** Returns the GPU back-end reference of the texture used by SkSurface, or zero - if SkSurface is not backed by a GPU texture. - - The returned texture handle is only valid until the next draw into SkSurface, - or when SkSurface is deleted. - - @param backendHandleAccess one of: kFlushRead_BackendHandleAccess, - kFlushWrite_BackendHandleAccess, kDiscardWrite_BackendHandleAccess - @return GPU texture reference - */ - GrBackendObject getTextureHandle(BackendHandleAccess backendHandleAccess); - - /** Returns true and stores the GPU back-end reference of the render target used - by SkSurface in backendObject. - - Return false if SkSurface is not backed by a GPU render target, and leaves - backendObject unchanged. - - The returned render target handle is only valid until the next draw into SkSurface, - or when SkSurface is deleted. - - In OpenGL this returns the frame buffer object ID. - - @param backendObject GPU intermediate memory buffer - @param backendHandleAccess one of: kFlushRead_BackendHandleAccess, - kFlushWrite_BackendHandleAccess, kDiscardWrite_BackendHandleAccess - @return true if SkSurface is backed by GPU texture - */ - bool getRenderTargetHandle(GrBackendObject* backendObject, - BackendHandleAccess backendHandleAccess); -#endif - /** Retrieves the backend texture. If Surface has no backend texture, an invalid object is returned. Call GrBackendTexture::isValid to determine if the result is valid. diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 1c86eaa374..784e15f8b0 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -99,14 +99,6 @@ public: }; virtual ResolveType getResolveType() const = 0; -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - /** - * Return the native ID or handle to the rendertarget, depending on the - * platform. e.g. on OpenGL, return the FBO ID. - */ - virtual GrBackendObject getRenderTargetHandle() const = 0; -#endif - virtual GrBackendRenderTarget getBackendRenderTarget() const = 0; // Checked when this object is asked to attach a stencil buffer. diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h index f7fdb77207..1f75c1f9be 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -25,14 +25,6 @@ public: GrTexture* asTexture() override { return this; } const GrTexture* asTexture() const override { return this; } -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - /** - * Return the native ID or handle to the texture, depending on the - * platform. e.g. on OpenGL, return the texture ID. - */ - virtual GrBackendObject getTextureHandle() const = 0; -#endif - virtual GrBackendTexture getBackendTexture() const = 0; /** diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h index d0e977ebc1..f908d1e1f6 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -207,14 +207,6 @@ enum class GrMipMapped : bool { /////////////////////////////////////////////////////////////////////////////// -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -/** - * Opaque type for 3D API object handles. We are moving away from this type and towards type-safe - * GrBackend* classes (e.g. GrBackendTexture). However, not all replacement APIs are in place yet. - */ -typedef intptr_t GrBackendObject; -#endif - /** * GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to * either the top-left or bottom-left content pixel. diff --git a/include/gpu/gl/GrGLTypes.h b/include/gpu/gl/GrGLTypes.h index 75aa87d971..5916c69181 100644 --- a/include/gpu/gl/GrGLTypes.h +++ b/include/gpu/gl/GrGLTypes.h @@ -128,9 +128,4 @@ struct GrGLFramebufferInfo { } }; -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrGLTextureInfo*)); -GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrGLFramebufferInfo*)); -#endif - #endif diff --git a/include/gpu/vk/GrVkTypes.h b/include/gpu/vk/GrVkTypes.h index 68b7f63064..0f7ff71d2e 100644 --- a/include/gpu/vk/GrVkTypes.h +++ b/include/gpu/vk/GrVkTypes.h @@ -112,8 +112,4 @@ struct GrVkImageInfo { } }; -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS -GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrVkImageInfo*)); -#endif - #endif 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 47df69928e..2049fb3561 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 62b97ae131..40e055e520 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 b4e6acf0c2..2f7b039488 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -51,29 +51,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; diff --git a/tests/VkBackendSurfaceTest.cpp b/tests/VkBackendSurfaceTest.cpp index 6b442a9725..3b3a9cec14 100644 --- a/tests/VkBackendSurfaceTest.cpp +++ b/tests/VkBackendSurfaceTest.cpp @@ -84,19 +84,6 @@ DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) { backendTexImage.setVkImageLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == vkTexture->currentLayout()); -#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS - // Verify that modifying the layout via the old textureHandle sitll works in is reflected in the - // GrVkTexture and GrBackendTexture. - GrVkImageInfo* backendInfo = (GrVkImageInfo*)wrappedImage->getTextureHandle(false); - REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL == backendInfo->fImageLayout); - - backendInfo->updateImageLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - REPORTER_ASSERT(reporter, - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == vkTexture->currentLayout()); - REPORTER_ASSERT(reporter, backendTexImage.getVkImageInfo(&info)); - REPORTER_ASSERT(reporter, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL == info.fImageLayout); -#endif - vkTexture->updateImageLayout(initLayout); REPORTER_ASSERT(reporter, backendTex.getVkImageInfo(&info)); |