From 080fdacc7063a1b467cc27bf2ba9beb1ba2bb7cf Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 23 Jul 2020 22:47:41 +0100 Subject: [PATCH] comp: Remove some vkDeviceWaitIdle calls and document other --- src/xrt/compositor/main/comp_distortion.c | 6 ++++++ src/xrt/compositor/main/comp_renderer.c | 9 ++++++--- src/xrt/compositor/main/comp_swapchain.c | 6 ++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/xrt/compositor/main/comp_distortion.c b/src/xrt/compositor/main/comp_distortion.c index 971f27e94..1132dc2aa 100644 --- a/src/xrt/compositor/main/comp_distortion.c +++ b/src/xrt/compositor/main/comp_distortion.c @@ -224,6 +224,12 @@ comp_distortion_destroy(struct comp_distortion *d) { struct vk_bundle *vk = d->vk; + /* + * This makes sure that any pending command buffer has completed and all + * resources referred by it can now be manipulated. This make sure that + * validation doesn't complain. This is done during destroy so isn't + * time critical. + */ vk->vkDeviceWaitIdle(vk->device); vk->vkDestroyDescriptorSetLayout(vk->device, d->descriptor_set_layout, diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index b81bf1906..3516c9aa3 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -513,8 +513,6 @@ comp_renderer_set_quad_layer(struct comp_renderer *r, l->transformation[i].offset = data->quad.sub.rect.offset; l->transformation[i].extent = data->quad.sub.rect.extent; } - - r->c->vk.vkDeviceWaitIdle(r->c->vk.device); } void @@ -550,7 +548,6 @@ comp_renderer_draw(struct comp_renderer *r) { _get_view_projection(r); comp_layer_renderer_draw(r->lr); - r->c->vk.vkDeviceWaitIdle(r->c->vk.device); r->c->window->flush(r->c->window); renderer_acquire_swapchain_image(r); @@ -683,6 +680,12 @@ renderer_resize(struct comp_renderer *r) { struct vk_bundle *vk = &r->c->vk; + /* + * This makes sure that any pending command buffer has completed and all + * resources referred by it can now be manipulated. This make sure that + * validation doesn't complain. This is done during resize so isn't time + * critical. + */ vk->vkDeviceWaitIdle(vk->device); vk_swapchain_create(&r->c->window->swapchain, r->c->current.width, diff --git a/src/xrt/compositor/main/comp_swapchain.c b/src/xrt/compositor/main/comp_swapchain.c index e4252e5b0..6b4e7f425 100644 --- a/src/xrt/compositor/main/comp_swapchain.c +++ b/src/xrt/compositor/main/comp_swapchain.c @@ -211,6 +211,12 @@ clean_image_views(struct vk_bundle *vk, static void image_cleanup(struct vk_bundle *vk, struct comp_swapchain_image *image) { + /* + * This makes sure that any pending command buffer has completed and all + * resources referred by it can now be manipulated. This make sure that + * validation doesn't complain. This is done during image destruction so + * isn't time critical. + */ vk->vkDeviceWaitIdle(vk->device); clean_image_views(vk, image->array_size, &image->views.alpha);