diff --git a/src/RenderDevice/Vulkan/VKDevice.cpp b/src/RenderDevice/Vulkan/VKDevice.cpp index 9f510f6c..a17d4844 100644 --- a/src/RenderDevice/Vulkan/VKDevice.cpp +++ b/src/RenderDevice/Vulkan/VKDevice.cpp @@ -286,10 +286,20 @@ bool Device::QueuePresent() { present_info.pImageIndices=¤t_frame; - if(vkQueuePresentKHR(attr->graphics_queue,&present_info)!=VK_SUCCESS) - return(false); - - if(vkQueueWaitIdle(attr->graphics_queue)!=VK_SUCCESS) + VkResult result=vkQueuePresentKHR(attr->graphics_queue,&present_info); + + if (!((result == VK_SUCCESS) || (result == VK_SUBOPTIMAL_KHR))) + { + if (result == VK_ERROR_OUT_OF_DATE_KHR) { + // Swap chain is no longer compatible with the surface and needs to be recreated + + return false; + } + } + + result=vkQueueWaitIdle(attr->graphics_queue); + + if(result!=VK_SUCCESS) return(false); return(true);