[gtk+/wip/gbsneto/vulkan-wayland: 1/3] vulkancontext: Respect driver's minimum image number



commit 8507bfff8c05dbff7e81ff3c0b4232fd7b7a00f0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 4 14:34:51 2017 -0200

    vulkancontext: Respect driver's minimum image number
    
    Thanks for LunarG validation layer for complaining about that.

 gdk/gdkvulkancontext.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index a6b1732..9d90446 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -183,7 +183,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext  *context,
   VkSwapchainKHR new_swapchain;
   VkResult res;
   VkDevice device;
-  guint i;
+  guint i, min_img_count;
 
   if (gdk_window_get_width (window) == priv->swapchain_width &&
       gdk_window_get_height (window) == priv->swapchain_height)
@@ -227,13 +227,15 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext  *context,
       capabilities.currentExtent.height = gdk_window_get_height (window) * gdk_window_get_scale_factor 
(window);
     }
 
+  min_img_count = CLAMP (2, capabilities.minImageCount, capabilities.maxImageCount ? 
capabilities.maxImageCount : G_MAXUINT32);
+
   res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
                                             &(VkSwapchainCreateInfoKHR) {
                                                 .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
                                                 .pNext = NULL,
                                                 .flags = 0,
                                                 .surface = priv->surface,
-                                                .minImageCount = 2,
+                                                .minImageCount = min_img_count,
                                                 .imageFormat = priv->image_format.format,
                                                 .imageColorSpace = priv->image_format.colorSpace,
                                                 .imageExtent = capabilities.currentExtent,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]