From 8916b8a7f4a017f62f654ba423251073d60984c3 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 11 Sep 2024 21:19:27 +0100 Subject: [PATCH] vulkan/wsi: Handle 0xFFFFFFFF special case in vk_wsi_force_swapchain_to_current_extent driconf Current extent can be 0xFFFFFFFF (-1) which indicates there is no current extent, and the swapchain will inherit that of which the application provides. Check this before applying the hack. Signed-off-by: Joshua Ashton Part-of: --- src/vulkan/wsi/wsi_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 286a6019f0f..55bc7cc3276 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1050,7 +1050,13 @@ wsi_CreateSwapchainKHR(VkDevice _device, .sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR, }; iface->get_capabilities2(surface, wsi_device, NULL, &caps2); - info.imageExtent = caps2.surfaceCapabilities.currentExtent; + + /* 0xffffffff (UINT32_MAX) indicates that the surface has no intrinsic extent, so the size of the + * surface will be the size of the swapchain. In this case, overriding the swapchain size makes + * no sense. + */ + if (caps2.surfaceCapabilities.currentExtent.width != UINT32_MAX) + info.imageExtent = caps2.surfaceCapabilities.currentExtent; } /* Ignore DEFERRED_MEMORY_ALLOCATION_BIT. Would require deep plumbing to be able to take advantage of it.