 
            From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 20 +++++++++++++++++++- dlls/win32u/win32u_private.h | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 6e54d0dc654..21bc707d073 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -52,6 +52,9 @@ static const UINT EXTERNAL_MEMORY_WIN32_BITS = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OP VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT | VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT; +static const UINT EXTERNAL_SEMAPHORE_WIN32_BITS = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT | + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT | + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT;
struct device_memory { @@ -189,6 +192,14 @@ static VkExternalMemoryHandleTypeFlagBits get_host_external_memory_type(void) return 0; }
+static VkExternalSemaphoreHandleTypeFlagBits get_host_external_semaphore_type(void) +{ + const char *host_extension = driver_funcs->p_get_host_extension( "VK_KHR_external_semaphore_win32" ); + if (!strcmp( host_extension, "VK_KHR_external_semaphore_fd" )) return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; + if (!strcmp( host_extension, "VK_KHR_external_semaphore_capabilities" )) return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; + return 0; +} + static void init_shared_resource_path( const WCHAR *name, UNICODE_STRING *str ) { UINT len = wcslen( name ); @@ -1422,15 +1433,22 @@ static VkResult win32u_vkImportSemaphoreWin32HandleKHR( VkDevice client_device, return VK_ERROR_INCOMPATIBLE_DRIVER; }
-static void win32u_vkGetPhysicalDeviceExternalSemaphoreProperties( VkPhysicalDevice client_physical_device, const VkPhysicalDeviceExternalSemaphoreInfo *semaphore_info, +static void win32u_vkGetPhysicalDeviceExternalSemaphoreProperties( VkPhysicalDevice client_physical_device, const VkPhysicalDeviceExternalSemaphoreInfo *client_semaphore_info, VkExternalSemaphoreProperties *semaphore_properties ) { + VkPhysicalDeviceExternalSemaphoreInfo *semaphore_info = (VkPhysicalDeviceExternalSemaphoreInfo *)client_semaphore_info; /* cast away const, it has been copied in the thunks */ struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); struct vulkan_instance *instance = physical_device->instance; + VkExternalSemaphoreHandleTypeFlagBits handle_type;
TRACE( "physical_device %p, semaphore_info %p, semaphore_properties %p\n", physical_device, semaphore_info, semaphore_properties );
+ handle_type = semaphore_info->handleType; + if (semaphore_info->handleType & EXTERNAL_SEMAPHORE_WIN32_BITS) semaphore_info->handleType = get_host_external_semaphore_type(); + instance->p_vkGetPhysicalDeviceExternalSemaphoreProperties( physical_device->host.physical_device, semaphore_info, semaphore_properties ); + semaphore_properties->compatibleHandleTypes = handle_type; + semaphore_properties->exportFromImportedHandleTypes = handle_type; }
static VkResult win32u_vkCreateFence( VkDevice client_device, const VkFenceCreateInfo *client_create_info, const VkAllocationCallbacks *allocator, VkFence *ret ) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 3c8745afab8..6fbd0b74c9f 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -209,6 +209,9 @@ extern D3DKMT_HANDLE d3dkmt_create_resource( D3DKMT_HANDLE *global ); extern D3DKMT_HANDLE d3dkmt_open_resource( D3DKMT_HANDLE global, HANDLE shared ); extern NTSTATUS d3dkmt_destroy_resource( D3DKMT_HANDLE local );
+extern D3DKMT_HANDLE d3dkmt_create_sync( D3DKMT_HANDLE *global ); +extern NTSTATUS d3dkmt_destroy_sync( D3DKMT_HANDLE local ); + /* winstation.c */
struct object_lock