swapchain: added return case of VK_ERROR_OUT_OF_DEVICE_MEMORY on vk_CreateSwapchainKHR() 51/91251/2
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Thu, 6 Oct 2016 11:15:45 +0000 (20:15 +0900)
committerMun, Gwan-gyeong <kk.moon@samsung.com>
Fri, 7 Oct 2016 04:22:40 +0000 (13:22 +0900)
Change-Id: I3d7275f1e8d525779a4004f36d8c38756c59cf3a

src/wsi/swapchain.c

index 8d5be33..6db4210 100644 (file)
@@ -128,10 +128,20 @@ vk_CreateSwapchainKHR(VkDevice                                                     device,
        res = tpl_surface_create_swapchain(chain->tpl_surface, format,
                                                                           info->imageExtent.width, info->imageExtent.height,
                                                                           info->minImageCount);
+       if (res == TPL_ERROR_OUT_OF_MEMORY) {
+               error = VK_ERROR_OUT_OF_DEVICE_MEMORY;
+               VK_ERROR("tpl_surface_create_swapchain() failed.\n");
+               goto error;
+       }
        VK_CHECK(res == TPL_ERROR_NONE, goto error, "tpl_surface_create_swapchain() failed.\n");
 
        /* Initialize swapchain buffers. */
        res = tpl_surface_get_swapchain_buffers(chain->tpl_surface, &buffers, &buffer_count);
+       if (res == TPL_ERROR_OUT_OF_MEMORY) {
+               error = VK_ERROR_OUT_OF_DEVICE_MEMORY;
+               VK_ERROR("tpl_surface_get_swapchain_buffers() failed.\n");
+               goto error_get_buffers;
+       }
        VK_CHECK(res == TPL_ERROR_NONE, goto error_get_buffers, "tpl_surface_get_swapchain_buffers() failed.\n");
 
        chain->buffers = vk_alloc(allocator, buffer_count * sizeof(vk_buffer_t),