KhronosGroup / KhronosGroup/Vulkan-Samples
Validation error in hello_triangle: semaphore must not be currently signaled.
- Dominant language
- C++
- Stars
- 5.4k
- Forks
- 835
- Avg merge
- 2h 16m
- Merged PRs (30d)
- 1
Description
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;
}
...
}
```
Contributor guide
Research direction
Start in the hello_triangle sample with acquire_next_image(), update(), and resize(), tracing how acquire_semaphore is added to and reused from recycled_semaphores after VK_SUBOPTIMAL_KHR or another failed acquire. Reproduce by resizing the window on Ubuntu 24.04 with Vulkan SDK 1.4.357, then verify that repeated acquisition no longer triggers the semaphore validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100