Immediate-Mode-UI / Immediate-Mode-UI/Nuklear
Strange clipping behavior in vulkan demo
- Dominant language
- C
- Stars
- 11.4k
- Forks
- 686
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 3
Description
When compiling/running the `glfw_vulkan` demo on NixOS 25.05 with the `glfw`, `vulkan-loader`, and `vulkan-headers` packages installed, I get the following weird clipping behavior:
https://github.com/user-attachments/assets/1cf0b0f8-c175-498c-a9a6-0cef219253fe
For comparison, the `glfw_opengl4` demo works perfectly for me.
I am *sometimes* getting a bunch of warnings like this from the validation layer:
```
Swapchain image 2 was presented but was not re-acquired, so VkSemaphore 0x310000000031 may still be in use and cannot be safely reused with image index 3.
Vulkan insight: One solution is to assign each image its own semaphore. Here are some common methods to ensure that a semaphore passed to vkQueuePresentKHR is not in use and can be safely reused:
a) Use a separate semaphore per swapchain image. Index these semaphores using the index of the acquired image.
b) Consider the VK_EXT_swapchain_maintenance1 extension. It allows using a VkFence with the presentation operation.
The Vulkan spec states: Each binary semaphore element of the pSignalSemaphores member of any element of pSubmits must be unsignaled when the semaphore signal operation it defines is executed on the device (https://docs.vulkan.org/spec/latest/chapters/cmdbuffers.html#VUID-vkQueueSubmit-pSignalSemaphores-00067)
validation layer: vkQueueSubmit(): pSubmits[0].pSignalSemaphores[0] (VkSemaphore 0x310000000031) is being signaled by VkQueue 0x1eb83170, but it may still be in use by VkSwapchainKHR 0x50000000005.
Here are the most recently acquired image indices: 0, 1, 2, [3], 4.
(brackets mark the last use of VkSemaphore 0x310000000031 in a presentation operation)
```
Sometimes these warnings does not show up. In either case, the demo is broken in the way shown in the mp4 attached above.
What could this be about?
Contributor guide
Research direction
Start by reproducing the clipping in the `glfw_vulkan` demo on NixOS 25.05 with the listed GLFW and Vulkan packages, then compare its behavior with `glfw_opengl4`. Use the validation-layer semaphore warnings and the attached video as symptoms; done means identifying the cause and confirming corrected rendering without those warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100