From: Rémi Bernon rbernon@codeweavers.com
The application might not be per-monitor aware and we will need to scale the vulkan surface ourselves, but rendering in per-monitor DPI unit will otherwise confuse it. --- dlls/winevulkan/vulkan.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 53b567e97d8..4980d42204d 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -38,15 +38,6 @@ static PFN_vkEnumerateInstanceVersion p_vkEnumerateInstanceVersion; static PFN_vkEnumerateInstanceExtensionProperties p_vkEnumerateInstanceExtensionProperties;
-/********************************************************************** - * get_win_monitor_dpi - */ -static UINT get_win_monitor_dpi( HWND hwnd ) -{ - return NtUserGetSystemDpiForProcess( NULL ); /* FIXME: get monitor dpi */ -} - - static int window_surface_compare(const void *key, const struct rb_entry *entry) { const struct wine_surface *surface = RB_ENTRY_VALUE(entry, struct wine_surface, window_entry); @@ -1740,7 +1731,7 @@ VkResult wine_vkAcquireNextImage2KHR(VkDevice device_handle, const VkAcquireNext acquire_info_host.swapchain = swapchain->host_swapchain; res = device->funcs.p_vkAcquireNextImage2KHR(device->host_device, &acquire_info_host, image_index);
- if (res == VK_SUCCESS && NtUserGetClientRect(surface->hwnd, &client_rect, get_win_monitor_dpi(surface->hwnd)) && + if (res == VK_SUCCESS && NtUserGetClientRect(surface->hwnd, &client_rect, NtUserGetDpiForWindow(surface->hwnd)) && !extents_equals(&swapchain->extents, &client_rect)) { WARN("Swapchain size %dx%d does not match client rect %s, returning VK_SUBOPTIMAL_KHR\n", @@ -1763,7 +1754,7 @@ VkResult wine_vkAcquireNextImageKHR(VkDevice device_handle, VkSwapchainKHR swapc res = device->funcs.p_vkAcquireNextImageKHR(device->host_device, swapchain->host_swapchain, timeout, semaphore, fence, image_index);
- if (res == VK_SUCCESS && NtUserGetClientRect(surface->hwnd, &client_rect, get_win_monitor_dpi(surface->hwnd)) && + if (res == VK_SUCCESS && NtUserGetClientRect(surface->hwnd, &client_rect, NtUserGetDpiForWindow(surface->hwnd)) && !extents_equals(&swapchain->extents, &client_rect)) { WARN("Swapchain size %dx%d does not match client rect %s, returning VK_SUBOPTIMAL_KHR\n", @@ -1871,7 +1862,7 @@ VkResult wine_vkQueuePresentKHR(VkQueue queue_handle, const VkPresentInfoKHR *pr RECT client_rect;
if (swapchain_res < VK_SUCCESS) continue; - if (!NtUserGetClientRect(surface->hwnd, &client_rect, get_win_monitor_dpi(surface->hwnd))) + if (!NtUserGetClientRect(surface->hwnd, &client_rect, NtUserGetDpiForWindow(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; @@ -2234,7 +2225,7 @@ static void adjust_surface_capabilities(struct wine_instance *instance, struct w
/* Update the image extents to match what the Win32 WSI would provide. */ /* FIXME: handle DPI scaling, somehow */ - NtUserGetClientRect(surface->hwnd, &client_rect, get_win_monitor_dpi(surface->hwnd)); + NtUserGetClientRect(surface->hwnd, &client_rect, NtUserGetDpiForWindow(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;