From fd3c481812d9a3c04b81658f45fadbfddf0e65de Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Mon, 3 Sep 2018 20:55:50 +0900 Subject: [PATCH] swapchain: Added some error condition to follow vk-spec. - minImageCount is the minimum number of presentable images that the application needs. The implementation will either create the swapchain with at least that many images, or it will fail to create the swapchain. Change-Id: I1711c50456fd3487a495497bfd526ca9bf30d308 Signed-off-by: Joonbum Ko --- src/wsi/swapchain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wsi/swapchain.c b/src/wsi/swapchain.c index 7549892..20ec874 100644 --- a/src/wsi/swapchain.c +++ b/src/wsi/swapchain.c @@ -139,6 +139,8 @@ vk_CreateSwapchainKHR(VkDevice device, error = chain->get_buffers(device, chain, &buffers, &chain->buffer_count); VK_CHECK(error == VK_SUCCESS, goto done, "swapchain backend get buffers failed.\n"); + VK_CHECK(chain->buffer_count >= info->minImageCount, goto error_mem_alloc, + "Insufficient buffer_count(%d >= %d)\n", chain->buffer_count, info->minImageCount); chain->buffers = vk_alloc(allocator, chain->buffer_count * sizeof(vk_buffer_t), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); -- 2.7.4