diff options
author | Brian Osman <brianosman@google.com> | 2018-05-10 22:04:08 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-10 22:04:20 +0000 |
commit | a0ca909142ba4fd33a1b2750f551e7edbb4b98f1 (patch) | |
tree | 862181c21d7464edc3c38fc5c54e0c93b2ff4284 /include | |
parent | 27fe397bc0cc1b091f9f85863c62b88156239cf0 (diff) |
Revert "Remove GrBackendObject and all related functions from Skia."
This reverts commit ccd4cfc23ebbbecbc6b292359352aad335ad7b73.
Reason for revert: Fuchsia not building again. (Flutter roll may have been reverted?)
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>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: Ie2c518b84b0c9513c0c622082de2831088b1ad8d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/127480
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkImage.h | 15 | ||||
-rw-r--r-- | include/core/SkSurface.h | 33 | ||||
-rw-r--r-- | include/gpu/GrRenderTarget.h | 8 | ||||
-rw-r--r-- | include/gpu/GrTexture.h | 8 | ||||
-rw-r--r-- | include/gpu/GrTypes.h | 8 | ||||
-rw-r--r-- | include/gpu/gl/GrGLTypes.h | 5 | ||||
-rw-r--r-- | include/gpu/vk/GrVkTypes.h | 4 |
7 files changed, 81 insertions, 0 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index 7e1ffaac66..6d3ae42fa4 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -534,6 +534,21 @@ 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 83a59f14fb..fb0a3685d7 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -428,6 +428,39 @@ 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 784e15f8b0..1c86eaa374 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -99,6 +99,14 @@ 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 1f75c1f9be..f7fdb77207 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -25,6 +25,14 @@ 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 f908d1e1f6..d0e977ebc1 100644 --- a/include/gpu/GrTypes.h +++ b/include/gpu/GrTypes.h @@ -207,6 +207,14 @@ 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 5916c69181..75aa87d971 100644 --- a/include/gpu/gl/GrGLTypes.h +++ b/include/gpu/gl/GrGLTypes.h @@ -128,4 +128,9 @@ 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 0f7ff71d2e..68b7f63064 100644 --- a/include/gpu/vk/GrVkTypes.h +++ b/include/gpu/vk/GrVkTypes.h @@ -112,4 +112,8 @@ struct GrVkImageInfo { } }; +#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS +GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrVkImageInfo*)); +#endif + #endif |