From d112c2d9225031591ff94e89784e2fe6acebaeb2 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 4 Nov 2022 17:51:33 +0100 Subject: render/vulkan: wait for device to become idle in vulkan_destroy() It's not safe to destroy any resources which might still be in-use by the GPU. Wait for any asynchronous tasks to complete before destroying everything. --- render/vulkan/renderer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index 72f09121..c64937aa 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -1120,6 +1120,11 @@ static void vulkan_destroy(struct wlr_renderer *wlr_renderer) { assert(!renderer->current_render_buffer); + VkResult res = vkDeviceWaitIdle(renderer->dev->dev); + if (res != VK_SUCCESS) { + wlr_vk_error("vkDeviceWaitIdle", res); + } + // stage.cb automatically freed with command pool struct wlr_vk_shared_buffer *buf, *tmp_buf; wl_list_for_each_safe(buf, tmp_buf, &renderer->stage.buffers, link) { -- cgit v1.2.3