From 500d5b99546000d3ce5de3dff57116f21bfc7390 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 9 Sep 2022 10:43:49 +0100 Subject: [PATCH] a/vk: Rename command buffer helpers --- src/xrt/auxiliary/vk/vk_helpers.c | 4 ++-- src/xrt/auxiliary/vk/vk_helpers.h | 6 +++--- src/xrt/compositor/client/comp_vk_client.c | 4 ++-- src/xrt/compositor/main/comp_layer_renderer.c | 4 ++-- src/xrt/compositor/main/comp_renderer.c | 4 ++-- src/xrt/compositor/main/comp_window_peek.c | 4 ++-- src/xrt/compositor/render/render_resources.c | 8 ++++---- src/xrt/compositor/util/comp_swapchain.c | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/xrt/auxiliary/vk/vk_helpers.c b/src/xrt/auxiliary/vk/vk_helpers.c index faebdcaba..d425b2c08 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.c +++ b/src/xrt/auxiliary/vk/vk_helpers.c @@ -1254,7 +1254,7 @@ vk_update_buffer(struct vk_bundle *vk, float *buffer, size_t buffer_size, VkDevi */ VkResult -vk_init_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer) +vk_cmd_buffer_create_and_begin(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer) { VkCommandBuffer cmd_buffer; VkResult ret; @@ -1305,7 +1305,7 @@ err_buffer: } XRT_CHECK_RESULT VkResult -vk_submit_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer cmd_buffer) +vk_cmd_buffer_submit(struct vk_bundle *vk, VkCommandBuffer cmd_buffer) { VkResult ret = VK_SUCCESS; VkFence fence; diff --git a/src/xrt/auxiliary/vk/vk_helpers.h b/src/xrt/auxiliary/vk/vk_helpers.h index e06582a03..4b50ec818 100644 --- a/src/xrt/auxiliary/vk/vk_helpers.h +++ b/src/xrt/auxiliary/vk/vk_helpers.h @@ -922,14 +922,14 @@ vk_update_buffer(struct vk_bundle *vk, float *buffer, size_t buffer_size, VkDevi */ /*! - * Create a new command buffer, takes the pool lock. + * Create and begins a new command buffer, takes the pool lock. * * @pre Requires successful call to vk_init_mutex. * * @ingroup aux_vk */ VkResult -vk_init_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer); +vk_cmd_buffer_create_and_begin(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer); /*! * A do everything command buffer submission function, during the operation @@ -946,7 +946,7 @@ vk_init_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd_buffer); * @ingroup aux_vk */ XRT_CHECK_RESULT VkResult -vk_submit_cmd_buffer(struct vk_bundle *vk, VkCommandBuffer cmd_buffer); +vk_cmd_buffer_submit(struct vk_bundle *vk, VkCommandBuffer cmd_buffer); /*! * Submits to the given queue, with the given fence. diff --git a/src/xrt/compositor/client/comp_vk_client.c b/src/xrt/compositor/client/comp_vk_client.c index 1464c0cc4..ea97aa577 100644 --- a/src/xrt/compositor/client/comp_vk_client.c +++ b/src/xrt/compositor/client/comp_vk_client.c @@ -646,11 +646,11 @@ client_vk_swapchain_create(struct xrt_compositor *xc, // Prerecord command buffers for swapchain image ownership/layout transitions for (uint32_t i = 0; i < xsc->image_count; i++) { - ret = vk_init_cmd_buffer(vk, &sc->acquire[i]); + ret = vk_cmd_buffer_create_and_begin(vk, &sc->acquire[i]); if (ret != VK_SUCCESS) { return XRT_ERROR_VULKAN; } - ret = vk_init_cmd_buffer(vk, &sc->release[i]); + ret = vk_cmd_buffer_create_and_begin(vk, &sc->release[i]); if (ret != VK_SUCCESS) { return XRT_ERROR_VULKAN; } diff --git a/src/xrt/compositor/main/comp_layer_renderer.c b/src/xrt/compositor/main/comp_layer_renderer.c index 60cac9eea..8ab961362 100644 --- a/src/xrt/compositor/main/comp_layer_renderer.c +++ b/src/xrt/compositor/main/comp_layer_renderer.c @@ -631,7 +631,7 @@ comp_layer_renderer_draw(struct comp_layer_renderer *self) struct vk_bundle *vk = self->vk; VkCommandBuffer cmd_buffer; - if (vk_init_cmd_buffer(vk, &cmd_buffer) != VK_SUCCESS) + if (vk_cmd_buffer_create_and_begin(vk, &cmd_buffer) != VK_SUCCESS) return; os_mutex_lock(&vk->cmd_pool_mutex); if (self->layer_count == 0) { @@ -641,7 +641,7 @@ comp_layer_renderer_draw(struct comp_layer_renderer *self) } os_mutex_unlock(&vk->cmd_pool_mutex); - VkResult res = vk_submit_cmd_buffer(vk, cmd_buffer); + VkResult res = vk_cmd_buffer_submit(vk, cmd_buffer); vk_check_error("vk_submit_cmd_buffer", res, ); } diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index 492aff304..5d7b14abc 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -1380,7 +1380,7 @@ mirror_to_debug_gui_do_blit(struct comp_renderer *r) } VkCommandBuffer cmd; - vk_init_cmd_buffer(vk, &cmd); + vk_cmd_buffer_create_and_begin(vk, &cmd); // For submitting commands. os_mutex_lock(&vk->cmd_pool_mutex); @@ -1481,7 +1481,7 @@ mirror_to_debug_gui_do_blit(struct comp_renderer *r) os_mutex_unlock(&vk->cmd_pool_mutex); // Waits for command to finish. - ret = vk_submit_cmd_buffer(vk, cmd); + ret = vk_cmd_buffer_submit(vk, cmd); if (ret != VK_SUCCESS) { //! @todo Better handling of error? COMP_ERROR(r->c, "Failed to mirror image"); diff --git a/src/xrt/compositor/main/comp_window_peek.c b/src/xrt/compositor/main/comp_window_peek.c index f03f1bdb1..e9426a041 100644 --- a/src/xrt/compositor/main/comp_window_peek.c +++ b/src/xrt/compositor/main/comp_window_peek.c @@ -169,9 +169,9 @@ comp_window_peek_create(struct comp_compositor *c) COMP_ERROR(c, "vkCreateSemaphore: %s", vk_result_string(ret)); } - ret = vk_init_cmd_buffer(vk, &w->cmd); + ret = vk_cmd_buffer_create_and_begin(vk, &w->cmd); if (ret != VK_SUCCESS) { - COMP_ERROR(c, "vk_init_cmd_buffer: %s", vk_result_string(ret)); + COMP_ERROR(c, "vk_cmd_buffer_create_and_begin: %s", vk_result_string(ret)); } os_thread_helper_init(&w->oth); diff --git a/src/xrt/compositor/render/render_resources.c b/src/xrt/compositor/render/render_resources.c index 974194cdd..908c80edb 100644 --- a/src/xrt/compositor/render/render_resources.c +++ b/src/xrt/compositor/render/render_resources.c @@ -741,14 +741,14 @@ render_resources_init(struct render_resources *r, VkCommandBuffer cmd = VK_NULL_HANDLE; - C(vk_init_cmd_buffer(vk, &cmd)); + C(vk_cmd_buffer_create_and_begin(vk, &cmd)); C(prepare_mock_image( // vk, // vk_bundle cmd, // cmd r->mock.color.image)); // dsat - C(vk_submit_cmd_buffer(vk, cmd)); + C(vk_cmd_buffer_submit(vk, cmd)); // No need to wait, submit waits on the fence. } @@ -997,7 +997,7 @@ render_distortion_buffer_init(struct render_resources *r, create_and_fill_in_distortion_buffer_for_view(vk, xdev, &buffers[1], &buffers[3], &buffers[5], 1, pre_rotate); VkCommandBuffer upload_buffer = VK_NULL_HANDLE; - C(vk_init_cmd_buffer(vk, &upload_buffer)); + C(vk_cmd_buffer_create_and_begin(vk, &upload_buffer)); for (uint32_t i = 0; i < COMP_DISTORTION_NUM_IMAGES; i++) { C(create_and_queue_upload( // @@ -1009,7 +1009,7 @@ render_distortion_buffer_init(struct render_resources *r, &r->distortion.image_views[i])); // out_image_view } - C(vk_submit_cmd_buffer(vk, upload_buffer)); + C(vk_cmd_buffer_submit(vk, upload_buffer)); os_mutex_lock(&vk->queue_mutex); vk->vkDeviceWaitIdle(vk->device); diff --git a/src/xrt/compositor/util/comp_swapchain.c b/src/xrt/compositor/util/comp_swapchain.c index 563a8a339..b8540e52d 100644 --- a/src/xrt/compositor/util/comp_swapchain.c +++ b/src/xrt/compositor/util/comp_swapchain.c @@ -184,7 +184,7 @@ do_post_create_vulkan_setup(struct vk_bundle *vk, * */ - vk_init_cmd_buffer(vk, &cmd_buffer); + vk_cmd_buffer_create_and_begin(vk, &cmd_buffer); VkImageAspectFlagBits image_barrier_aspect = vk_csci_get_barrier_aspect_mask(image_view_format); @@ -208,7 +208,7 @@ do_post_create_vulkan_setup(struct vk_bundle *vk, subresource_range); // } - ret = vk_submit_cmd_buffer(vk, cmd_buffer); + ret = vk_cmd_buffer_submit(vk, cmd_buffer); if (ret != VK_SUCCESS) { //! @todo Propegate error VK_ERROR(vk, "Failed to barrier images");