Bad handling of VK_ERROR_OUT_OF_DATE_KHR returned from vkAcquireNextImageKHR

Open
#30 2 comments 0 reactions 1 assignee View on GitHub

@SaschaWillems is already working on this.

Since May 14, 2026.

Assessment

This issue has not been assessed yet.

Description

bug

Currently (permalink), if vkAcquireNextImageKHR returns VK_ERROR_OUT_OF_DATE_KHR, the tutorial code reacts by setting updateSwapchain = true (so that the swapchain is recreated at a later time) and proceeds as usual.

That would be appropriate for VK_SUBOPTIMAL_KHR, but it's not appropriate for VK_ERROR_OUT_OF_DATE_KHR.
VK_ERROR_OUT_OF_DATE_KHR is a failure. The spec says:

If VK_ERROR_OUT_OF_DATE_KHR is returned, no image is acquired

and also

If vkAcquireNextImageKHR does not successfully acquire an image, semaphore and fence are unaffected.

So if vkAcquireNextImageKHR returns VK_ERROR_OUT_OF_DATE_KHR, the main loop is going to break down in some weird way. Presumably it will deadlock, because the presentSemaphores[frameIndex] is never going to be signalled, so the vkQueueSubmit will wait forever on it.

Dominant language
C++
Stars
681
Forks
63
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SaschaWillems/HowToVulkan

All issues in SaschaWillems/HowToVulkan

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.