mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Advance DX12 bridge dispatch path and guard Win32 Vulkan handle exports
This commit is contained in:
parent
b65f3e0aa3
commit
94a441e234
2 changed files with 227 additions and 18 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue