From 03aa3086a0c1a7401b60098b4719300f7107e016 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Fri, 8 Mar 2024 15:01:13 -0500 Subject: [PATCH] demo: don't error-out on image count difference The Vulkan spec states that create_info.minImageCount determines the minimum number of images to create, not the exact count. The count retrieved via vkGetSwapchainImagesKHR can (and in my case does) differ - without penalty to the rest of the demo. --- demo/glfw_vulkan/main.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/demo/glfw_vulkan/main.c b/demo/glfw_vulkan/main.c index a77f2da..071ec31 100644 --- a/demo/glfw_vulkan/main.c +++ b/demo/glfw_vulkan/main.c @@ -758,7 +758,6 @@ bool create_swap_chain(struct vulkan_demo *demo) { VkResult result; VkSwapchainCreateInfoKHR create_info; uint32_t queue_family_indices[2]; - uint32_t old_swap_chain_images_len; bool ret = false; queue_family_indices[0] = (uint32_t)demo->indices.graphics; @@ -815,22 +814,12 @@ bool create_swap_chain(struct vulkan_demo *demo) { goto cleanup; } - old_swap_chain_images_len = demo->swap_chain_images_len; result = vkGetSwapchainImagesKHR(demo->device, demo->swap_chain, &demo->swap_chain_images_len, NULL); if (result != VK_SUCCESS) { fprintf(stderr, "vkGetSwapchainImagesKHR failed: %d\n", result); goto cleanup; } - if (old_swap_chain_images_len > 0 && - old_swap_chain_images_len != demo->swap_chain_images_len) { - fprintf(stderr, - "number of assigned swap chain images changed between " - "runs. old: %u, new: %u\n", - (unsigned)old_swap_chain_images_len, - (unsigned)demo->swap_chain_images_len); - goto cleanup; - } if (demo->swap_chain_images == NULL) { demo->swap_chain_images = malloc(demo->swap_chain_images_len * sizeof(VkImage));