diff options
| author | skallweitNV <64953474+skallweitNV@users.noreply.github.com> | 2024-02-27 17:42:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-27 08:42:39 -0800 |
| commit | e3fdfe5176e28c6b4548aeb860c1abaa1987ee57 (patch) | |
| tree | fa9b88565426eff0d8c91e1743b41ff96383d79c /tools/gfx/vulkan/vk-texture.cpp | |
| parent | 188482e83dc4f7dc4c940214033dd95518b9d18c (diff) | |
add support for shared resources on vulkan/linux (#3636)
Diffstat (limited to 'tools/gfx/vulkan/vk-texture.cpp')
| -rw-r--r-- | tools/gfx/vulkan/vk-texture.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/gfx/vulkan/vk-texture.cpp b/tools/gfx/vulkan/vk-texture.cpp index 80a120033..13775cef0 100644 --- a/tools/gfx/vulkan/vk-texture.cpp +++ b/tools/gfx/vulkan/vk-texture.cpp @@ -64,6 +64,23 @@ Result TextureResourceImpl::getSharedHandle(InteropHandle* outHandle) SLANG_RETURN_ON_FAIL( vkCreateSharedHandle(m_device->m_device, &info, (HANDLE*)&outHandle->handleValue) != VK_SUCCESS); +#else + VkMemoryGetFdInfoKHR info = {}; + info.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; + info.pNext = nullptr; + info.memory = m_imageMemory; + info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + + auto& api = m_device->m_api; + PFN_vkGetMemoryFdKHR vkCreateSharedHandle; + vkCreateSharedHandle = api.vkGetMemoryFdKHR; + if (!vkCreateSharedHandle) + { + return SLANG_FAIL; + } + SLANG_RETURN_ON_FAIL( + vkCreateSharedHandle(m_device->m_device, &info, (int*)&outHandle->handleValue) != + VK_SUCCESS); #endif outHandle->api = InteropHandleAPI::Vulkan; return SLANG_OK; |
