Nuklear
Nuklear copied to clipboard
Strange clipping behavior in vulkan demo
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?
vulkaninfo --summary output:
==========
VULKANINFO
==========
Vulkan Instance Version: 1.3.296
Instance Extensions: count = 24
-------------------------------
VK_EXT_acquire_drm_display : extension revision 1
VK_EXT_acquire_xlib_display : extension revision 1
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_direct_mode_display : extension revision 1
VK_EXT_display_surface_counter : extension revision 1
VK_EXT_headless_surface : extension revision 1
VK_EXT_surface_maintenance1 : extension revision 1
VK_EXT_swapchain_colorspace : extension revision 5
VK_KHR_device_group_creation : extension revision 1
VK_KHR_display : extension revision 23
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2 : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_portability_enumeration : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_surface_protected_capabilities : extension revision 1
VK_KHR_wayland_surface : extension revision 6
VK_KHR_xcb_surface : extension revision 6
VK_KHR_xlib_surface : extension revision 6
VK_LUNARG_direct_driver_loading : extension revision 1
Instance Layers: count = 6
--------------------------
VK_LAYER_KHRONOS_validation Khronos Validation Layer 1.3.296 version 1
VK_LAYER_MESA_device_select Linux device selection layer 1.4.303 version 1
VK_LAYER_VALVE_steam_fossilize_32 Steam Pipeline Caching Layer 1.3.207 version 1
VK_LAYER_VALVE_steam_fossilize_64 Steam Pipeline Caching Layer 1.3.207 version 1
VK_LAYER_VALVE_steam_overlay_32 Steam Overlay Layer 1.3.207 version 1
VK_LAYER_VALVE_steam_overlay_64 Steam Overlay Layer 1.3.207 version 1
Devices:
========
GPU0:
apiVersion = 1.4.305
driverVersion = 25.0.7
vendorID = 0x1002
deviceID = 0x15bf
deviceType = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
deviceName = AMD Radeon 780M (RADV PHOENIX)
driverID = DRIVER_ID_MESA_RADV
driverName = radv
driverInfo = Mesa 25.0.7
conformanceVersion = 1.4.0.0
deviceUUID = 00000000-c400-0000-0000-000000000000
driverUUID = 414d442d-4d45-5341-2d44-525600000000
GPU1:
apiVersion = 1.4.305
driverVersion = 25.0.7
vendorID = 0x1002
deviceID = 0x7480
deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
deviceName = AMD Radeon RX 7700S (RADV NAVI33)
driverID = DRIVER_ID_MESA_RADV
driverName = radv
driverInfo = Mesa 25.0.7
conformanceVersion = 1.4.0.0
deviceUUID = 00000000-0300-0000-0000-000000000000
driverUUID = 414d442d-4d45-5341-2d44-525600000000
GPU2:
apiVersion = 1.4.305
driverVersion = 0.0.1
vendorID = 0x10005
deviceID = 0x0000
deviceType = PHYSICAL_DEVICE_TYPE_CPU
deviceName = llvmpipe (LLVM 19.1.7, 256 bits)
driverID = DRIVER_ID_MESA_LLVMPIPE
driverName = llvmpipe
driverInfo = Mesa 25.0.7 (LLVM 19.1.7)
conformanceVersion = 1.3.1.1
deviceUUID = 6d657361-3235-2e30-2e37-000000000000
driverUUID = 6c6c766d-7069-7065-5555-494400000000