Advance DX12 bridge dispatch path and guard Win32 Vulkan handle exports

This commit is contained in:
Kelsi 2026-03-09 01:49:18 -07:00
parent b65f3e0aa3
commit 94a441e234
2 changed files with 227 additions and 18 deletions

View file

@ -117,6 +117,13 @@ static int envIntOrDefault(const char* key, int defaultValue) {
#if defined(_WIN32)
static uint64_t exportImageMemoryHandleWin32(VkDevice device, PFN_vkGetDeviceProcAddr getDeviceProcAddr,
VmaAllocator allocator, const AllocatedImage& image) {
#if !defined(VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR) || !defined(VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT)
(void)device;
(void)getDeviceProcAddr;
(void)allocator;
(void)image;
return 0;
#else
if (!device || !getDeviceProcAddr || !allocator || !image.allocation) return 0;
auto getMemHandle = reinterpret_cast<PFN_vkGetMemoryWin32HandleKHR>(
getDeviceProcAddr(device, "vkGetMemoryWin32HandleKHR"));
@ -134,10 +141,17 @@ static uint64_t exportImageMemoryHandleWin32(VkDevice device, PFN_vkGetDevicePro
HANDLE outHandle = nullptr;
if (getMemHandle(device, &handleInfo, &outHandle) != VK_SUCCESS || !outHandle) return 0;
return reinterpret_cast<uint64_t>(outHandle);
#endif
}
static uint64_t exportSemaphoreHandleWin32(VkDevice device, PFN_vkGetDeviceProcAddr getDeviceProcAddr,
VkSemaphore semaphore) {
#if !defined(VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR) || !defined(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT)
(void)device;
(void)getDeviceProcAddr;
(void)semaphore;
return 0;
#else
if (!device || !getDeviceProcAddr || !semaphore) return 0;
auto getSemHandle = reinterpret_cast<PFN_vkGetSemaphoreWin32HandleKHR>(
getDeviceProcAddr(device, "vkGetSemaphoreWin32HandleKHR"));
@ -151,6 +165,7 @@ static uint64_t exportSemaphoreHandleWin32(VkDevice device, PFN_vkGetDeviceProcA
HANDLE outHandle = nullptr;
if (getSemHandle(device, &handleInfo, &outHandle) != VK_SUCCESS || !outHandle) return 0;
return reinterpret_cast<uint64_t>(outHandle);
#endif
}
#endif