diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-04 17:51:33 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-11-11 19:18:04 +0000 |
commit | d112c2d9225031591ff94e89784e2fe6acebaeb2 (patch) | |
tree | b71530289db48c14a003408602e140bd3a9defbf | |
parent | f4f3c15c1e801760876da1fe292f24bd9f47b8ad (diff) |
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.
-rw-r--r-- | render/vulkan/renderer.c | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |