swapchain: Added some error condition to follow vk-spec. 91/188291/1 accepted/tizen/unified/20180904.180645 submit/tizen/20180904.025652
authorJoonbum Ko <joonbum.ko@samsung.com>
Mon, 3 Sep 2018 11:55:50 +0000 (20:55 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Mon, 3 Sep 2018 11:55:55 +0000 (20:55 +0900)
 - 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 <joonbum.ko@samsung.com>
src/wsi/swapchain.c

index 75498929102eb6d6e4adb11d854283fabd3d6600..20ec8745e697778a82b4305b97ac7287e4742b57 100644 (file)
@@ -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);