aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/vulkan/utils.h
diff options
context:
space:
mode:
authorGravatar Philip Langdale <philipl@overt.org>2018-09-29 17:56:07 -0700
committerGravatar sfan5 <sfan5@live.de>2018-10-22 21:35:48 +0200
commit93f800a00f3f8ef416082e0a3f9d34d979a1e9a6 (patch)
treeb5108b3c2f4f4357adf0f9921c6b59a6c8e162e6 /video/out/vulkan/utils.h
parent6fbd933108a74bbd3a375be1456692320a97380e (diff)
vo_gpu: vulkan: Add support for exporting buffer memory
The CUDA/Vulkan interop works on the basis of memory being exported from Vulkan and then imported by CUDA. To enable this, we add a way to declare a buffer as being intended for export, and then add a function to do the export. For now, we support the fd and Handle based exports on Linux and Windows respectively. There are others, which we can support when a need arises. Also note that this is just for exporting buffers, rather than textures (VkImages). Image import on the CUDA side is supposed to work, but it is currently buggy and waiting for a new driver release. Finally, at least with my nvidia hardware and drivers, everything seems to work even if we don't initialise the buffer with the right exportability options. Nevertheless I'm enforcing it so that we're following the spec.
Diffstat (limited to 'video/out/vulkan/utils.h')
-rw-r--r--video/out/vulkan/utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/vulkan/utils.h b/video/out/vulkan/utils.h
index 2962313257..97d1c24489 100644
--- a/video/out/vulkan/utils.h
+++ b/video/out/vulkan/utils.h
@@ -10,6 +10,12 @@
#define VK_LOAD_PFN(name) PFN_##name pfn_##name = (PFN_##name) \
vkGetInstanceProcAddr(vk->inst, #name);
+#if HAVE_WIN32_DESKTOP
+ #define MP_VK_EXTERNAL_MEMORY_EXPORT_EXTENSION_NAME VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME
+#else
+ #define MP_VK_EXTERNAL_MEMORY_EXPORT_EXTENSION_NAME VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME
+#endif
+
// Return a human-readable name for various struct mpvk_ctx enums
const char* vk_err(VkResult res);