Skip to content

Swapchain recreation: Semaphore is left signaled #388

@V-Fries

Description

@V-Fries

Inside the drawFrame() function in the chapter "Swap chain recreation" during the acquisition of the next image index:

VkResult result = vkAcquireNextImageKHR(device, swapChain, UINT64_MAX, imageAvailableSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex);

if (result == VK_ERROR_OUT_OF_DATE_KHR) {
    recreateSwapChain();
    return;
} else if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR) {
    throw std::runtime_error("failed to acquire swap chain image!");
}

In the case vkAcquireNextImageKHR() returns VK_ERROR_OUT_OF_DATE_KHR the drawFrame() function will return with imageAvailableSemaphores[currentFrame] being signaled which causes the following validation error during the next iteration:

[Validation layer][ERROR][VALIDATION]: "Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] Object 0: handle = 0xe7f79a0000000005, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0xe9e4b2a9 | vkAcquireNextImage
KHR():  Semaphore must not be currently signaled. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must be unsignaled (https://vulkan.lunarg.com/doc/view/1.3.283.0/mac/1.3-extensions/vkspec.html#VUID-vkAcquire
NextImageKHR-semaphore-01286)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions