a/vk: Rename command buffer helpers

This commit is contained in:
Jakob Bornecrantz 2022-09-09 10:43:49 +01:00
parent eeaaaf398b
commit 500d5b9954
8 changed files with 19 additions and 19 deletions

View file

@ -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;

View file

@ -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.

View file

@ -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;
}

View file

@ -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, );
}

View file

@ -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");

View file

@ -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);

View file

@ -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);

View file

@ -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");