From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/win32u/vulkan.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 310ce8923c9..416d4eeb833 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -1576,7 +1576,7 @@ static void win32u_vkDestroySurfaceKHR( VkInstance client_instance, VkSurfaceKHR static BOOL get_surface_rect( HWND hwnd, RECT *rect, UINT dpi ) { - if (!NtUserGetPresentRect( hwnd, rect, dpi ) && !NtUserGetClientRect( hwnd, rect, dpi )) return FALSE; + if (!get_present_rect( hwnd, rect, dpi ) && !get_client_rect( hwnd, rect, dpi )) return FALSE; OffsetRect( rect, -rect->left, -rect->top ); return TRUE; } @@ -1597,7 +1597,7 @@ static void adjust_surface_capabilities( struct vulkan_instance *instance, struc /* Update the image extents to match what the Win32 WSI would provide. */ /* FIXME: handle DPI scaling, somehow */ - get_surface_rect( surface->hwnd, &client_rect, NtUserGetDpiForWindow( surface->hwnd ) ); + get_surface_rect( surface->hwnd, &client_rect, get_dpi_for_window( surface->hwnd ) ); capabilities->minImageExtent.width = client_rect.right - client_rect.left; capabilities->minImageExtent.height = client_rect.bottom - client_rect.top; capabilities->maxImageExtent.width = client_rect.right - client_rect.left; @@ -1827,6 +1827,7 @@ static VkResult win32u_vkCreateSwapchainKHR( VkDevice client_device, const VkSwa VkSwapchainKHR host_swapchain; RECT client_rect; VkResult res; + UINT raw_dpi; if (!NtUserIsWindow( surface->hwnd )) { @@ -1848,7 +1849,8 @@ static VkResult win32u_vkCreateSwapchainKHR( VkDevice client_device, const VkSwa * display mode change emulation), MoltenVK's vkQueuePresentKHR returns VK_SUBOPTIMAL_KHR. * Create the swapchain with VkSwapchainPresentScalingCreateInfoEXT to avoid this. */ - if (get_surface_rect( surface->hwnd, &client_rect, NtUserGetWinMonitorDpi( surface->hwnd, MDT_RAW_DPI ) ) && + get_win_monitor_dpi( surface->hwnd, &raw_dpi ); + if (get_surface_rect( surface->hwnd, &client_rect, raw_dpi ) && !extents_equals( &create_info_host.imageExtent, &client_rect ) && instance->extensions.has_VK_EXT_surface_maintenance1 && physical_device->extensions.has_VK_KHR_swapchain_maintenance1) @@ -1907,7 +1909,7 @@ static VkResult win32u_vkAcquireNextImage2KHR( VkDevice client_device, const VkA acquire_info_host.fence = fence ? fence->host.fence : 0; res = device->p_vkAcquireNextImage2KHR( device->host.device, &acquire_info_host, image_index ); - if (!res && get_surface_rect( surface->hwnd, &client_rect, NtUserGetDpiForWindow( surface->hwnd ) ) && + if (!res && get_surface_rect( surface->hwnd, &client_rect, get_dpi_for_window( surface->hwnd ) ) && !extents_equals( &swapchain->extents, &client_rect )) { WARN( "Swapchain size %dx%d does not match client rect %s, returning VK_SUBOPTIMAL_KHR\n", @@ -1933,7 +1935,7 @@ static VkResult win32u_vkAcquireNextImageKHR( VkDevice client_device, VkSwapchai semaphore ? semaphore->host.semaphore : 0, fence ? fence->host.fence : 0, image_index ); - if (!res && get_surface_rect( surface->hwnd, &client_rect, NtUserGetDpiForWindow( surface->hwnd ) ) && + if (!res && get_surface_rect( surface->hwnd, &client_rect, get_dpi_for_window( surface->hwnd ) ) && !extents_equals( &swapchain->extents, &client_rect )) { WARN( "Swapchain size %dx%d does not match client rect %s, returning VK_SUBOPTIMAL_KHR\n", @@ -1994,7 +1996,7 @@ static VkResult win32u_vkQueuePresentKHR( VkQueue client_queue, const VkPresentI client_surface_present( surface->client ); if (swapchain_res < VK_SUCCESS) continue; - if (!get_surface_rect( surface->hwnd, &client_rect, NtUserGetDpiForWindow( surface->hwnd ) )) + if (!get_surface_rect( surface->hwnd, &client_rect, get_dpi_for_window( surface->hwnd ) )) { WARN( "Swapchain window %p is invalid, returning VK_ERROR_OUT_OF_DATE_KHR\n", surface->hwnd ); if (present_info->pResults) present_info->pResults[i] = VK_ERROR_OUT_OF_DATE_KHR; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11301