vulkan/wsi: Make wsi_win32_surface_get_capabilities() return the current extent

We can get that information with GetClientRect(), and some applications
complain when the window size doesn't match the currentExtent values.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16394>
This commit is contained in:
Boris Brezillon 2022-04-27 17:57:25 +02:00 committed by Marge Bot
parent 35d82ecf1e
commit 718070f0e7

View file

@ -116,15 +116,24 @@ wsi_win32_surface_get_support(VkIcdSurfaceBase *surface,
}
static VkResult
wsi_win32_surface_get_capabilities(VkIcdSurfaceBase *surface,
wsi_win32_surface_get_capabilities(VkIcdSurfaceBase *surf,
struct wsi_device *wsi_device,
VkSurfaceCapabilitiesKHR* caps)
{
VkIcdSurfaceWin32 *surface = (VkIcdSurfaceWin32 *)surf;
RECT win_rect;
if (!GetClientRect(surface->hwnd, &win_rect))
return VK_ERROR_SURFACE_LOST_KHR;
caps->minImageCount = 1;
/* There is no real maximum */
caps->maxImageCount = 0;
caps->currentExtent = (VkExtent2D) { UINT32_MAX, UINT32_MAX };
caps->currentExtent = (VkExtent2D) {
win_rect.right - win_rect.left,
win_rect.bottom - win_rect.top
};
caps->minImageExtent = (VkExtent2D) { 1, 1 };
caps->maxImageExtent = (VkExtent2D) {
wsi_device->maxImageDimension2D,