c/render: Free command buffer when closing rendering

This commit is contained in:
Jakob Bornecrantz 2021-11-03 23:10:40 +00:00
parent 4759ddda63
commit 36765256a6

View file

@ -507,6 +507,20 @@ update_mesh_discriptor_set(struct vk_bundle *vk,
NULL); // pDescriptorCopies
}
static void
destroy_command_buffer(struct vk_bundle *vk, VkCommandBuffer command_buffer)
{
os_mutex_lock(&vk->cmd_pool_mutex);
vk->vkFreeCommandBuffers( //
vk->device, // device
vk->cmd_pool, // commandPool
1, // commandBufferCount
&command_buffer); // pCommandBuffers
os_mutex_unlock(&vk->cmd_pool_mutex);
}
/*
*
@ -625,6 +639,9 @@ comp_rendering_close(struct comp_rendering *rr)
struct vk_bundle *vk = vk_from_rr(rr);
struct comp_resources *r = rr->r;
destroy_command_buffer(vk, rr->cmd);
rr->cmd = VK_NULL_HANDLE;
// Reclaimed by vkResetDescriptorPool.
rr->views[0].mesh.descriptor_set = VK_NULL_HANDLE;
rr->views[1].mesh.descriptor_set = VK_NULL_HANDLE;