aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan/renderer.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-05-12 16:13:24 +0200
committerSimon Ser <contact@emersion.fr>2023-05-12 16:13:24 +0200
commit8cdc4b7a31d8a3eba4e2ae7cf32bdc808e46538d (patch)
tree7dfa080dfc89ed00583ee9b8b508daa681fe49d8 /render/vulkan/renderer.c
parent47e175ae7ff562b680378914b8826bf0ffce8470 (diff)
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)
Diffstat (limited to 'render/vulkan/renderer.c')
-rw-r--r--render/vulkan/renderer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index a9adc1af..b704caca 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -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);