aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrBackendSurface.h
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-04-10 09:34:07 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-10 14:20:22 +0000
commit52e16d984898f18c84de773507da875a7954b922 (patch)
tree61dc6aaa14903f6b8c2e7e55d5d40c136e653354 /include/gpu/GrBackendSurface.h
parent58627cb8eb559670b86f06225eb87e6c1c5e8504 (diff)
Update getBackendInfo calls on GrBackendTexture to support VkImageLayout better.
The big api level change here is that the getBackendInfo calls now return by value instead of a pointer. These changes are being made in support of Vulkan so that the client can update the VkImageLayout on the GrBackendTexture and have that update get reflected in our internal tracking of the image. This is done by storing a ref counted GrVkImageLayout object on the GrBackendTexture and the GrVkImage. Bug: skia: Change-Id: I8c6158fd3a66eb61fef97ebf09ea5364bca3f1ae Reviewed-on: https://skia-review.googlesource.com/119101 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include/gpu/GrBackendSurface.h')
-rw-r--r--include/gpu/GrBackendSurface.h46
1 files changed, 36 insertions, 10 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h
index f0d716cad0..f0bbab5689 100644
--- a/include/gpu/GrBackendSurface.h
+++ b/include/gpu/GrBackendSurface.h
@@ -14,6 +14,9 @@
#ifdef SK_VULKAN
#include "vk/GrVkTypes.h"
+#include "../private/GrVkTypesPriv.h"
+
+class GrVkImageLayout;
#endif
#if !SK_SUPPORT_GPU
@@ -136,24 +139,33 @@ public:
GrMipMapped,
const GrMockTextureInfo& mockInfo);
+ GrBackendTexture(const GrBackendTexture& that);
+
+ ~GrBackendTexture();
+
+ GrBackendTexture& operator=(const GrBackendTexture& that);
+
int width() const { return fWidth; }
int height() const { return fHeight; }
bool hasMipMaps() const { return GrMipMapped::kYes == fMipMapped; }
GrBackend backend() const {return fBackend; }
- // If the backend API is GL, this returns a pointer to the GrGLTextureInfo struct. Otherwise
- // it returns nullptr.
- const GrGLTextureInfo* getGLTextureInfo() const;
+ // If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in
+ // pointer and returns true. Otherwise returns false if the backend API is not GL.
+ bool getGLTextureInfo(GrGLTextureInfo*) 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 GrGLImageInfo 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;
+
+ void setVkImageLayout(VkImageLayout);
#endif
- // If the backend API is Mock, this returns a pointer to the GrMockTextureInfo struct. Otherwise
- // it returns nullptr.
- const GrMockTextureInfo* getMockTextureInfo() 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 getMockTextureInfo(GrMockTextureInfo*) const;
// Returns true if the backend texture has been initialized.
bool isValid() const { return fIsValid; }
@@ -182,6 +194,20 @@ private:
GrPixelConfig config() const { return fConfig; }
+#ifdef SK_VULKAN
+ // Requires friending of GrVkGpu (done above already)
+ sk_sp<GrVkImageLayout> getGrVkImageLayout() const;
+
+ friend class GrVkTexture;
+ GrBackendTexture(int width,
+ int height,
+ 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
@@ -192,7 +218,7 @@ private:
union {
GrGLTextureInfo fGLInfo;
#ifdef SK_VULKAN
- GrVkImageInfo fVkInfo;
+ GrVkBackendSurfaceInfo fVkInfo;
#endif
GrMockTextureInfo fMockInfo;
};