From: Paul Gofman <pgofman@codeweavers.com> --- dlls/win32u/opengl.c | 4 ++-- dlls/win32u/sysparams.c | 3 ++- dlls/win32u/vulkan.c | 44 ++++++++++++++++++++++++++---------- dlls/win32u/win32u_private.h | 9 +++++++- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index ad4390486d7..70851f0139a 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -2402,9 +2402,9 @@ static BOOL win32u_query_renderer( UINT attribute, void *value ) switch (attribute) { case GL_DEVICE_LUID_EXT: - return get_gpu_luid_from_uuid( &egl->device_uuid, (LUID *)value, &mask ); + return get_gpu_info_from_uuid( &egl->device_uuid, (LUID *)value, &mask, NULL ); case GL_DEVICE_NODE_MASK_EXT: - return get_gpu_luid_from_uuid( &egl->device_uuid, &luid, value ); + return get_gpu_info_from_uuid( &egl->device_uuid, &luid, value, NULL ); default: FIXME( "Unsupported attribute %#x\n", attribute ); set_gl_error( GL_INVALID_ENUM ); diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 6081b35cf23..945b03c0b15 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -8064,7 +8064,7 @@ BOOL get_gpu_uuid_from_luid( const LUID *luid, GUID *uuid ) } /* Find the GPU LUID corresponding to a device UUID */ -BOOL get_gpu_luid_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask ) +BOOL get_gpu_info_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask, char *name ) { BOOL found = FALSE; struct gpu *gpu; @@ -8076,6 +8076,7 @@ BOOL get_gpu_luid_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask ) if (!IsEqualGUID( uuid, &gpu->uuid )) continue; *luid = gpu->luid; *node_mask = 1; + if (name) unicodez_to_ascii( name, gpu->name ); found = TRUE; break; } diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 69721c2161b..91c29ced209 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -448,11 +448,10 @@ static VkResult convert_instance_create_info( struct mempool *pool, VkInstanceCr if (instance->obj.extensions.has_VK_KHR_win32_surface && vulkan_funcs.host_extensions.has_VK_EXT_surface_maintenance1) instance->obj.extensions.has_VK_EXT_surface_maintenance1 = 1; - if (use_external_memory()) - { + if (vulkan_funcs.host_extensions.has_VK_KHR_get_physical_device_properties2) instance->obj.extensions.has_VK_KHR_get_physical_device_properties2 = 1; + if (use_external_memory()) instance->obj.extensions.has_VK_KHR_external_memory_capabilities = 1; - } /* VK_KHR_win32_keyed_mutex only requires external memory extensions, but we will use * external semaphore fds to implement it, so we enable the instance extensions too */ @@ -1676,8 +1675,11 @@ static void *find_vk_struct( void *s, VkStructureType t ) return NULL; } -static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) +static void get_fixed_up_physical_device_properties2( struct vulkan_physical_device *physical_device, VkPhysicalDeviceProperties2 *properties2, + PFN_vkGetPhysicalDeviceProperties2 p_vkGetPhysicalDeviceProperties2 ) { + VkPhysicalDeviceIDProperties id_host = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES }; + VkPhysicalDeviceProperties2 properties2_host; VkPhysicalDeviceVulkan11Properties *vk11; VkPhysicalDeviceIDProperties *id; VkBool32 device_luid_valid; @@ -1688,9 +1690,21 @@ static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) vk11 = find_vk_struct( properties2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES ); id = find_vk_struct( properties2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES ); - if (!vk11 && !id) return; - uuid = (const GUID *)(id ? id->deviceUUID : vk11->deviceUUID); - device_luid_valid = get_gpu_luid_from_uuid( uuid, &luid, &node_mask ); + if (!vk11 && !id) + { + properties2_host = *properties2; + id_host.pNext = properties2->pNext; + properties2_host.pNext = &id_host; + p_vkGetPhysicalDeviceProperties2( physical_device->host.physical_device, &properties2_host ); + properties2->properties = properties2_host.properties; + } + else p_vkGetPhysicalDeviceProperties2( physical_device->host.physical_device, properties2 ); + + if (id) uuid = (const GUID *)id->deviceUUID; + else if (vk11) uuid = (const GUID *)vk11->deviceUUID; + else uuid = (const GUID *)id_host.deviceUUID; + + device_luid_valid = get_gpu_info_from_uuid( uuid, &luid, &node_mask, properties2->properties.deviceName ); if (!device_luid_valid) WARN( "luid for %s not found\n", debugstr_guid(uuid) ); if (id) @@ -1714,24 +1728,30 @@ static void fill_luid_property( VkPhysicalDeviceProperties2 *properties2 ) static void win32u_vkGetPhysicalDeviceProperties( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties *properties ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); + VkPhysicalDeviceProperties2 properties2 = {.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 }; - physical_device->instance->p_vkGetPhysicalDeviceProperties( physical_device->host.physical_device, properties ); + if (!physical_device->instance->extensions.has_VK_KHR_get_physical_device_properties2) + { + physical_device->instance->p_vkGetPhysicalDeviceProperties( physical_device->host.physical_device, properties ); + return; + } + get_fixed_up_physical_device_properties2( physical_device, &properties2, + physical_device->instance->p_vkGetPhysicalDeviceProperties2KHR ); + *properties = properties2.properties; } static void win32u_vkGetPhysicalDeviceProperties2( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties2 *properties2 ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); - physical_device->instance->p_vkGetPhysicalDeviceProperties2( physical_device->host.physical_device, properties2 ); - fill_luid_property( properties2 ); + get_fixed_up_physical_device_properties2( physical_device, properties2, physical_device->instance->p_vkGetPhysicalDeviceProperties2 ); } static void win32u_vkGetPhysicalDeviceProperties2KHR( VkPhysicalDevice client_physical_device, VkPhysicalDeviceProperties2 *properties2 ) { struct vulkan_physical_device *physical_device = vulkan_physical_device_from_handle( client_physical_device ); - physical_device->instance->p_vkGetPhysicalDeviceProperties2KHR( physical_device->host.physical_device, properties2 ); - fill_luid_property( properties2 ); + get_fixed_up_physical_device_properties2( physical_device, properties2, physical_device->instance->p_vkGetPhysicalDeviceProperties2KHR ); } static VkResult win32u_vkGetPhysicalDeviceSurfaceFormatsKHR( VkPhysicalDevice client_physical_device, VkSurfaceKHR client_surface, diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 0f9d17644b5..f3c15f1be79 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -190,7 +190,7 @@ extern void user_lock(void); extern void user_unlock(void); extern void user_check_not_lock(void); extern BOOL get_gpu_uuid_from_luid( const LUID *luid, GUID *uuid ); -extern BOOL get_gpu_luid_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask ); +extern BOOL get_gpu_info_from_uuid( const GUID *uuid, LUID *luid, UINT32 *node_mask, char *name ); /* d3dkmtc. */ @@ -402,6 +402,13 @@ static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src ) return (p - dst) * sizeof(WCHAR); } +static inline UINT unicodez_to_ascii( char *dst, const WCHAR *src ) +{ + char *p = dst; + while ((*p++ = *src++)); + return p - dst; +} + static inline BOOL is_win9x(void) { return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9916