diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2017-01-03 21:11:57 -0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-01-04 13:23:48 +0100 |
commit | 38d6e45b32cec7d1aa65d393d9a12b4402d303db (patch) | |
tree | 98c7a4643225c48af7c0a8f0f03d8988995c3bc2 | |
parent | d62e18ac8736cec000682b3f526e611a549accfe (diff) | |
download | gtk+-38d6e45b32cec7d1aa65d393d9a12b4402d303db.tar.gz |
vulkancontext: Assume the window geometry when extents are bogus
When the current extent is -1, we should assume whatever size
the GdkWindow has.
-rw-r--r-- | gdk/gdkvulkancontext.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index e64cd2f1eb..a6b1732619 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, |