[gtk+/wip/gbsneto/vulkan-wayland: 2/4] vulkancontext: Assume the window geometry when extents are bogus



commit 8d40ccae7e074849c652d70d847ccdd6ed797fb3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 3 21:11:57 2017 -0200

    vulkancontext: Assume the window geometry when extents are bogus
    
    When the current extent is 0xFFFFFFFF, we should assume whatever size
    the GdkWindow has.

 gdk/gdkvulkancontext.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index e64cd2f..a6b1732 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -216,6 +216,17 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext  *context,
       composite_alpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
     }
 
+  /*
+   * Per 
https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/xhtml/vkspec.html#VkSurfaceCapabilitiesKHR
+   * the current extent may assume a special value, meaning that the extend should assume whatever
+   * value the window has.
+   */
+  if (capabilities.currentExtent.width == -1 || capabilities.currentExtent.height == -1)
+    {
+      capabilities.currentExtent.width = gdk_window_get_width (window) * gdk_window_get_scale_factor 
(window);
+      capabilities.currentExtent.height = gdk_window_get_height (window) * gdk_window_get_scale_factor 
(window);
+    }
+
   res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
                                             &(VkSwapchainCreateInfoKHR) {
                                                 .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,


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