Skip to content

Validation error in hello_triangle: semaphore must not be currently signaled. #1565

Description

@MarkCallow

This is on Ubuntu 24.04 with "mesa-vulkan-drivers/noble-updates,noble-updates,noble-security,now 25.2.8-0ubuntu0.24.04.2".

This is a new validation check in Vulkan SDK 1.4.357. It happens in my own app so, looking for a solution, I tried hello_triangle but it suffers too. To reproduce, simply resize the window.

Here is the error.

Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] | MessageID = 0xe9e4b2a9
vkAcquireNextImageKHR(): 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.4.357.1/linux/antora/spec/latest/chapters/VK_KHR_surface/wsi.html#VUID-vkAcquireNextImageKHR-semaphore-01286)
Objects: 1
    [0] VkSemaphore 0x1d100000001d1

I believe this is because the driver is signalling the semaphore when it returns VK_SUBOPTIMAL_KHR. In this case acquire_next_image pushes the semaphore onto recycled_semaphores and returns to update
which calls resize() then acquire_next_image() again which proceeds to pull the signaled semaphore off recycled_semaphores and reuses it. The same recycling happens if the second acquire_next_image fails.

acquire_next_image
	VkResult res = vkAcquireNextImageKHR(context.device, context.swapchain, UINT64_MAX, acquire_semaphore, VK_NULL_HANDLE, image);

	if (res != VK_SUCCESS)
	{
		context.recycled_semaphores.push_back(acquire_semaphore);
		return res;
	}
        ...
}

void HelloTriangle::update(float delta_time)
{
        ...
	auto res = acquire_next_image(&index);

	// Handle outdated error in acquire.
	if (res == VK_SUBOPTIMAL_KHR || res == VK_ERROR_OUT_OF_DATE_KHR)
	{
		resize(context.swapchain_dimensions.width, context.swapchain_dimensions.height);
		res = acquire_next_image(&index);
	}

	if (res != VK_SUCCESS)
	{
		vkQueueWaitIdle(context.queue);
		return;
	}
        ...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions