Skip to content

vulkan: Add support for managing command buffer lifecycles

Faith Ekstrand requested to merge gfxstrand/mesa:vulkan/cmd-pool-reuse into main

This MR pulls the command buffer recycling concept from RADV into common code and cleans it up a bit. This is more-or-less a counter-proposal to !16919 (closed). The primary difference is that we ditch the toolkit model for more of a framework model where we have a vtable for three basic command buffer operations: create, destroy, and reset and the rest is handled in common code. This lets us more easily manage lifecycles directly in common code and get everyone command buffer object recycling.

For implementations which wish to cache other stuff in the pool, independent of whole command buffer caching, they can return said stuff to the pool when vk_command_buffer_ops::reset is called with VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT. This will happen on vkFreeCommandBuffers(), regardless of whether or not the object gets recycled.

Merge request reports