cube: Handle occlusion where currentExtent == 0xFFFFFFFF
authorJoshua Ashton <joshua@froggi.es>
Thu, 17 Jun 2021 17:30:14 +0000 (18:30 +0100)
committerjeremyk-lunarg <jeremyk@lunarg.com>
Thu, 17 Jun 2021 19:12:11 +0000 (13:12 -0600)
The Vulkan spec states that: "On some platforms, it is normal that maxImageExtent may become (0, 0), for example when the window is minimized. In such a case, it is not possible to create a swapchain due to the Valid Usage requirements."

Yet vkcube previously only handled this path for platforms where currentExtent != 0xFFFFFFFF.

cube/cube.c

index faaed11..c3440f8 100644 (file)
@@ -1237,7 +1237,7 @@ static void demo_prepare_buffers(struct demo *demo) {
         demo->height = surfCapabilities.currentExtent.height;
     }
 
-    if (demo->width == 0 || demo->height == 0) {
+    if (surfCapabilities.maxImageExtent.width == 0 || surfCapabilities.maxImageExtent.height == 0) {
         demo->is_minimized = true;
         return;
     } else {