render/vulkan: wait for idle queue before destroying render buffer

This fixes the following validation errors when shutting down Sway:

    00:00:01.263 [wlr] [render/vulkan/vulkan.c:65] Validation Error: [ VUID-vkDestroyFramebuffer-framebuffer-00892 ] Object 0: handle = 0x62e00003c400, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdb308312 | Cannot call vkDestroyFramebuffer on VkFramebuffer 0x2e2cd000000002b[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to framebuffer must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkDestroyFramebuffer-framebuffer-00892) (VUID-vkDestroyFramebuffer-framebuffer-00892)
    00:00:01.264 [wlr] [render/vulkan/vulkan.c:65] Validation Error: [ VUID-vkDestroyImage-image-01000 ] Object 0: handle = 0x62e00003c400, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf2d29b5a | Cannot call vkDestroyImage on VkImage 0x3fbcd60000000028[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkDestroyImage-image-01000) (VUID-vkDestroyImage-image-01000)
This commit is contained in:
Simon Ser 2023-05-12 16:13:24 +02:00
parent 47e175ae7f
commit 8cdc4b7a31
1 changed files with 7 additions and 0 deletions

View File

@ -569,6 +569,13 @@ static void destroy_render_buffer(struct wlr_vk_render_buffer *buffer) {
VkDevice dev = buffer->renderer->dev->dev;
// TODO: asynchronously wait for the command buffers using this render
// buffer to complete (just like we do for textures)
VkResult res = vkQueueWaitIdle(buffer->renderer->dev->queue);
if (res != VK_SUCCESS) {
wlr_vk_error("vkQueueWaitIdle", res);
}
vkDestroyFramebuffer(dev, buffer->framebuffer, NULL);
vkDestroyImageView(dev, buffer->image_view, NULL);
vkDestroyImage(dev, buffer->image, NULL);