diff options
author | Greg Daniel <egdaniel@google.com> | 2018-04-10 13:46:30 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-11 11:14:58 +0000 |
commit | 323fbcf6d18f1a82b76cc3e471015dc9717e7fb5 (patch) | |
tree | 6542aa1caf6b2f7e0a473cbf0b42ed397b2722d4 /include/gpu/GrBackendSurface.h | |
parent | 3b6afd51b22c14fdfd5e741b809c5e02c6ec2095 (diff) |
Move GrBackendRenderTarget over to new system of getting backed infos
Bug: skia:
Change-Id: I3927390894715e8424b3d0240dad3ee6cd03dc38
Reviewed-on: https://skia-review.googlesource.com/120181
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu/GrBackendSurface.h')
-rw-r--r-- | include/gpu/GrBackendSurface.h | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index f0bbab5689..2fe33096f3 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -155,11 +155,13 @@ public: bool getGLTextureInfo(GrGLTextureInfo*) const; #ifdef SK_VULKAN - // If the backend API is Vulkan, copies a snapshot of the GrGLImageInfo struct into the passed + // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed // in pointer and returns true. This snapshot will set the fImageLayout to the current layout // state. Otherwise returns false if the backend API is not Vulkan. bool getVkImageInfo(GrVkImageInfo*) const; + // Anytime the client changes the VkImageLayout of the VkImage captured by this + // GrBackendTexture, they must call this function to notify Skia of the changed layout. void setVkImageLayout(VkImageLayout); #endif @@ -263,23 +265,35 @@ public: int stencilBits, const GrMockRenderTargetInfo& mockInfo); + ~GrBackendRenderTarget(); + + GrBackendRenderTarget(const GrBackendRenderTarget& that); + GrBackendRenderTarget& operator=(const GrBackendRenderTarget&); + int width() const { return fWidth; } int height() const { return fHeight; } int sampleCnt() const { return fSampleCnt; } int stencilBits() const { return fStencilBits; } GrBackend backend() const {return fBackend; } - // If the backend API is GL, this returns a pointer to the GrGLFramebufferInfo struct. Otherwise - // it returns nullptr. - const GrGLFramebufferInfo* getGLFramebufferInfo() const; + // If the backend API is GL, copies a snapshot of the GrGLFramebufferInfo struct into the passed + // in pointer and returns true. Otherwise returns false if the backend API is not GL. + bool getGLFramebufferInfo(GrGLFramebufferInfo*) const; #ifdef SK_VULKAN - // If the backend API is Vulkan, this returns a pointer to the GrVkImageInfo struct. Otherwise - // it returns nullptr - const GrVkImageInfo* getVkImageInfo() const; + // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed + // in pointer and returns true. This snapshot will set the fImageLayout to the current layout + // state. Otherwise returns false if the backend API is not Vulkan. + bool getVkImageInfo(GrVkImageInfo*) const; + + // Anytime the client changes the VkImageLayout of the VkImage captured by this + // GrBackendRenderTarget, they must call this function to notify Skia of the changed layout. + void setVkImageLayout(VkImageLayout); #endif - const GrMockRenderTargetInfo* getMockRenderTargetInfo() const; + // If the backend API is Mock, copies a snapshot of the GrMockTextureInfo struct into the passed + // in pointer and returns true. Otherwise returns false if the backend API is not Mock. + bool getMockRenderTargetInfo(GrMockRenderTargetInfo*) const; // Returns true if the backend texture has been initialized. bool isValid() const { return fIsValid; } @@ -301,6 +315,18 @@ private: friend class GrVkGpu; GrPixelConfig config() const { return fConfig; } +#ifdef SK_VULKAN + // Requires friending of GrVkGpu (done above already) + sk_sp<GrVkImageLayout> getGrVkImageLayout() const; + + friend class GrVkRenderTarget; + GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo, + sk_sp<GrVkImageLayout> layout); +#endif + + // Free and release and resources being held by the GrBackendTexture. + void cleanup(); + bool fIsValid; int fWidth; //<! width in pixels int fHeight; //<! height in pixels @@ -314,7 +340,7 @@ private: union { GrGLFramebufferInfo fGLInfo; #ifdef SK_VULKAN - GrVkImageInfo fVkInfo; + GrVkBackendSurfaceInfo fVkInfo; #endif GrMockRenderTargetInfo fMockInfo; }; |