From 15733282f119b15438063a4f96d01e4ae5b525fd Mon Sep 17 00:00:00 2001 From: "joonbum.ko" Date: Tue, 14 Nov 2017 11:10:17 +0900 Subject: [PATCH] swapchain_tpl: Added handling error case when acquire next buffer. Change-Id: I99b87e0185e3801cf4c06cdfce3fd3dfecb1b465 Signed-off-by: joonbum.ko --- src/wsi/swapchain_tpl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wsi/swapchain_tpl.c b/src/wsi/swapchain_tpl.c index 9612fae..909c38c 100644 --- a/src/wsi/swapchain_tpl.c +++ b/src/wsi/swapchain_tpl.c @@ -57,14 +57,15 @@ swapchain_tpl_acquire_next_image(VkDevice device, { vk_swapchain_tpl_t *swapchain_tpl = chain->backend_data; - if (sync) { - *tbm_surface = tpl_surface_dequeue_buffer_with_sync(swapchain_tpl->tpl_surface, - timeout, sync); - if (*tbm_surface == NULL) + *tbm_surface = tpl_surface_dequeue_buffer_with_sync(swapchain_tpl->tpl_surface, + timeout, sync); + if (*tbm_surface == NULL) { + if (timeout == 0) + return VK_NOT_READY; + else if (timeout != UINT64_MAX) return VK_TIMEOUT; - } else { - *tbm_surface = tpl_surface_dequeue_buffer(swapchain_tpl->tpl_surface); - VK_CHECK(*tbm_surface, return VK_ERROR_SURFACE_LOST_KHR, "tpl_surface_dequeue_buffers() failed.\n"); + else + return VK_ERROR_SURFACE_LOST_KHR; } return VK_SUCCESS; @@ -72,7 +73,7 @@ swapchain_tpl_acquire_next_image(VkDevice device, static void swapchain_tpl_deinit(VkDevice device, - vk_swapchain_t *chain) + vk_swapchain_t *chain) { vk_swapchain_tpl_t *swapchain_tpl = chain->backend_data; -- 2.7.4