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.
This commit is contained in:
Simon Ser 2022-11-04 17:51:33 +01:00
parent f4f3c15c1e
commit d112c2d922

View file

@ -1120,6 +1120,11 @@ static void vulkan_destroy(struct wlr_renderer *wlr_renderer) {
assert(!renderer->current_render_buffer); 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 // stage.cb automatically freed with command pool
struct wlr_vk_shared_buffer *buf, *tmp_buf; struct wlr_vk_shared_buffer *buf, *tmp_buf;
wl_list_for_each_safe(buf, tmp_buf, &renderer->stage.buffers, link) { wl_list_for_each_safe(buf, tmp_buf, &renderer->stage.buffers, link) {