From ffae0010c4a7af25601e286c9488a72889b5b8b1 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 4 Sep 2024 21:12:57 +0200 Subject: [PATCH] vulkan: Set VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT It seems Mesa doesn't support that yet, but having it doesn't hurt. And it allows drivers to allocate less memory for the swapchains, because we don't need all the 4 images we request in minImageCount. But drivers tend to take that minimum image count as gospel, so we need to use a higher number to not cause lag in corner cases. --- gdk/gdkvulkancontext.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 2b81fd8ccb..83288f3add 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -467,8 +467,9 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context, res = GDK_VK_CHECK (vkCreateSwapchainKHR, device, &(VkSwapchainCreateInfoKHR) { .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, - .pNext = NULL, - .flags = 0, + .flags = + (gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE) ? + VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT : 0), .surface = priv->surface, .minImageCount = CLAMP (4, capabilities.minImageCount,