Fix resize error

This commit is contained in:
Bailey Harrison 2022-10-21 14:17:28 +01:00
parent 36c07aa4d1
commit f697d37791

View File

@ -954,15 +954,16 @@ namespace engine {
res = vkResetFences(pimpl->device, 1, &pimpl->inFlightFence); res = vkResetFences(pimpl->device, 1, &pimpl->inFlightFence);
assert(res == VK_SUCCESS); assert(res == VK_SUCCESS);
uint32_t imageIndex; uint32_t imageIndex = 0;
res = vkAcquireNextImageKHR(pimpl->device, pimpl->swapchain.swapchain, UINT64_MAX, pimpl->swapchain.acquireSemaphore, VK_NULL_HANDLE, &imageIndex); res = vkAcquireNextImageKHR(pimpl->device, pimpl->swapchain.swapchain, UINT64_MAX, pimpl->swapchain.acquireSemaphore, VK_NULL_HANDLE, &imageIndex);
if (res == VK_SUBOPTIMAL_KHR || res == VK_ERROR_OUT_OF_DATE_KHR) { if (res == VK_ERROR_OUT_OF_DATE_KHR) {
// recreate swapchain // recreate swapchain
waitIdle(); waitIdle();
createSwapchain(pimpl->device, pimpl->physicalDevice, pimpl->queues, pimpl->window, pimpl->surface, &pimpl->swapchain); createSwapchain(pimpl->device, pimpl->physicalDevice, pimpl->queues, pimpl->window, pimpl->surface, &pimpl->swapchain);
return;
} }
else { else {
assert(res == VK_SUCCESS); assert(res == VK_SUCCESS || res == VK_SUBOPTIMAL_KHR);
} }
res = vkResetCommandBuffer(pimpl->commandBuffer, 0); res = vkResetCommandBuffer(pimpl->commandBuffer, 0);