Skip to content

vulkan: Don't queue presentation if image acquisition fails

Doğukan Korkmaztürk requested to merge dkorkmazturk/gtk:main into main

Currently, GTK does not check the result of vkAcquireNextImageKHR() and assumes that it always succeeds. As a result, the vkQueuePresentKHR() is unconditionally set to wait for the semaphore passed to vkAcquireNextImageKHR() earlier.

However, if vkAcquireNextImageKHR() fails for some reason, the semaphore passed to it does not get signalled. This causes the presentation command to wait for the semaphore to be signalled indefinitely, which causes GTK to hang.

This change adds error handling around vkAcquireNextImageKHR() and vkQueuePresentKHR() commands to make GTK recreate the Vulkan swapchain when it is necessary and avoid situations that could cause indefinite waits.

I am not sure if this specific solution is the best way to handle this problem in GTK. Especially the way I recreate the swapchain here seems hacky at best. So I created the MR as a draft hoping that we could discuss it and find the best possible way to structure it.

Merge request reports