I'm trying to make a simple vulkan program. The structure of my code is very similar to vulkan-tutorial's, except I'd like to recreate the swapchain without calling vkDeviceWaitIdle. As such, I'm waiting on all of the fences for the frames in flight instead.

However, this does not seem to work. For some reason, it seems like the very first frame submitted after the swapchain recreation never signals its fence. Here is the code if you would like to have a look -- swapchain recreation happens at line 1135, after calling vkAcquireNextImageKHR. I've left the log calls in to make it clearer what the output below means.

And here is an example output, where the program froze right after logging those lines :

-- FRAME 381 --
Waiting until frame #2 is rendered.
Done waiting.
Acquiring an image.
Waiting on all fences before destroying swapchain
Frame #0 (0x100000000010) is available
Frame #1 (0x130000000013) is available
Frame #2 (0x160000000016) is available
Recreated swapchain
Acquiring an image.
Rendering to image #0
Submitted queue, going to signal fence #2 (0x340000000034)
-- FRAME 382 --
Waiting until frame #0 is rendered.
Done waiting.
Acquiring an image.
Rendering to image #1
Submitted queue, going to signal fence #0 (0x2e000000002e)
-- FRAME 383 --
Waiting until frame #1 is rendered.
Done waiting.
Acquirendering to image #0
Image #0 in use by frame #2 (0x340000000034), waiting.

As you can see, vkQueueSubmit is supposed to signal fence #2 when it is done with frame 381. But then, frame 383 waits indefinitely for that very fence to be signaled, and I cannot see why.

Do you guys know what is going on here ? Thanks in advance.

  • $\begingroup$ What is the state of the semaphores? $\endgroup$
    – pmw1234
    May 4 '21 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.