aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/vk
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-02-23 17:06:10 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-24 16:09:33 +0000
commit9ad1f92e2fceea33215c0f13cee42a679fb88d44 (patch)
treef44afa1066b401ae5e3cf189078ff6fceaccca78 /include/gpu/vk
parent20de615e3d02ff52c9a3c319ce35bcaace97be25 (diff)
Add GrExternalTextureData and SkCrossContextImageData
GrExternalTextureData is an API for exporting the backend-specific information about a texture in a type-safe way, and without pointing into the GrTexture. The new detachBackendTexture API lets us release ownership of a texture to the client. SkCrossContextImageData is the public API that lets clients upload textures on one thread/GrContext, then safely transfer ownership to another thread and GrContext for rendering. Only GL is implemented/supported right now. Vulkan support requires that we add thread-safe memory pools, or otherwise transfer the actual memory block containing the texture to the new context. BUG=skia: Change-Id: I784a3a74be69807df038c7d192eaed002c7e45ca Reviewed-on: https://skia-review.googlesource.com/8529 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu/vk')
-rw-r--r--include/gpu/vk/GrVkTypes.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/gpu/vk/GrVkTypes.h b/include/gpu/vk/GrVkTypes.h
index aa1334adca..e9a312160d 100644
--- a/include/gpu/vk/GrVkTypes.h
+++ b/include/gpu/vk/GrVkTypes.h
@@ -9,6 +9,7 @@
#ifndef GrVkTypes_DEFINED
#define GrVkTypes_DEFINED
+#include "GrExternalTextureData.h"
#include "GrTypes.h"
#include "vk/GrVkDefines.h"
@@ -59,6 +60,23 @@ struct GrVkImageInfo {
void updateImageLayout(VkImageLayout layout) { fImageLayout = layout; }
};
+class GrVkExternalTextureData : public GrExternalTextureData {
+public:
+ GrVkExternalTextureData(const GrVkImageInfo& info, GrFence fence)
+ : INHERITED(fence)
+ , fInfo(info) {}
+ GrBackend getBackend() const override { return kVulkan_GrBackend; }
+
+protected:
+ GrBackendObject getBackendObject() const override {
+ return reinterpret_cast<GrBackendObject>(&fInfo);
+ }
+
+ GrVkImageInfo fInfo;
+
+ typedef GrExternalTextureData INHERITED;
+};
+
GR_STATIC_ASSERT(sizeof(GrBackendObject) >= sizeof(const GrVkImageInfo*));
#endif