Skip to content

Commit

Permalink
- slightly adjust AcquireImage to avoid border cases in the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Apr 11, 2019
1 parent a0f6183 commit 59904fa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/rendering/vulkan/system/vk_swapchain.cpp
Expand Up @@ -40,15 +40,23 @@ uint32_t VulkanSwapChain::AcquireImage(int width, int height, VulkanSemaphore *s
}

VkResult result = vkAcquireNextImageKHR(device->device, swapChain, 1'000'000'000, semaphore ? semaphore->semaphore : VK_NULL_HANDLE, fence ? fence->fence : VK_NULL_HANDLE, &imageIndex);
if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR || result == VK_TIMEOUT)
if (result == VK_SUCCESS)
{
Recreate();
break;
}
else if (result == VK_SUCCESS)
else if (result == VK_SUBOPTIMAL_KHR)
{
// Force the recreate to happen next frame.
// The spec is not very clear about what happens to the semaphore or the acquired image if the swapchain is recreated before the image is released with a call to vkQueuePresentKHR.
lastSwapWidth = 0;
lastSwapHeight = 0;
break;
}
else if (result == VK_NOT_READY)
else if (result == VK_ERROR_OUT_OF_DATE_KHR)
{
Recreate();
}
else if (result == VK_NOT_READY || result == VK_TIMEOUT)
{
imageIndex = 0xffffffff;
break;
Expand Down

0 comments on commit 59904fa

Please sign in to comment.