Monado OpenXR Runtime
vk_cmd_pool Struct Reference

Small helper to manage lock around a command pool. More...

#include <vk/vk_cmd_pool.h>

Collaboration diagram for vk_cmd_pool:

Public Member Functions

XRT_CHECK_RESULT VkResult vk_cmd_pool_init (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandPoolCreateFlags flags)
 Create a command buffer pool. More...
 
void vk_cmd_pool_destroy (struct vk_bundle *vk, struct vk_cmd_pool *pool)
 Destroy a command buffer pool, lock must not be held, externally synchronizable with all other pool commands. More...
 
XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer *out_cmd_buffer)
 Create a command buffer, call with the pool mutex held. More...
 
XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBufferUsageFlags flags, VkCommandBuffer *out_cmd_buffer)
 Create a command buffer and also begin it, call with the pool mutex held. More...
 
XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 Submit to the vulkan queue, will take the queue mutex. More...
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 A do everything submit function, will take the queue mutex. More...
 
static void vk_cmd_pool_lock (struct vk_cmd_pool *pool)
 Lock the command pool, needed for creating command buffers, filling out commands on any command buffers created from this pool and submitting any command buffers created from this pool to a VkQueue. More...
 
static void vk_cmd_pool_unlock (struct vk_cmd_pool *pool)
 Unlock the command pool. More...
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer *out_cmd_buffer)
 Locks, calls vk_cmd_pool_create_cmd_buffer_locked, and then unlocks the command pool. More...
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBufferUsageFlags flags, VkCommandBuffer *out_cmd_buffer)
 Locks, calls vk_cmd_pool_create_and_begin_cmd_buffer_locked, and then unlocks the command pool. More...
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit (struct vk_bundle *vk, struct vk_cmd_pool *pool, uint32_t count, const VkSubmitInfo *infos, VkFence fence)
 Locks, calls vk_cmd_submit_locked, and then unlocks the command pool. More...
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 Locks, calls vk_cmd_pool_submit_cmd_buffer_locked, and then unlocks the command pool. More...
 
static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer (struct vk_bundle *vk, struct vk_cmd_pool *pool, VkCommandBuffer cmd_buffer)
 Locks, calls vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked, and then unlocks the command pool. More...
 

Data Fields

VkCommandPool pool
 
struct os_mutex mutex
 

Detailed Description

Small helper to manage lock around a command pool.

Member Function Documentation

◆ vk_cmd_pool_create_and_begin_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBufferUsageFlags  flags,
VkCommandBuffer *  out_cmd_buffer 
)
inline

◆ vk_cmd_pool_create_and_begin_cmd_buffer_locked()

XRT_CHECK_RESULT VkResult vk_cmd_pool_create_and_begin_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBufferUsageFlags  flags,
VkCommandBuffer *  out_cmd_buffer 
)

Create a command buffer and also begin it, call with the pool mutex held.

Precondition
Command pool lock must be held.

References vk_cmd_pool_create_cmd_buffer_locked().

Referenced by vk_cmd_pool_create_and_begin_cmd_buffer().

◆ vk_cmd_pool_create_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer *  out_cmd_buffer 
)
inline

◆ vk_cmd_pool_create_cmd_buffer_locked()

XRT_CHECK_RESULT VkResult vk_cmd_pool_create_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer *  out_cmd_buffer 
)

Create a command buffer, call with the pool mutex held.

Precondition
Command pool lock must be held, see vk_cmd_pool_lock.

Referenced by vk_cmd_pool_create_and_begin_cmd_buffer_locked(), and vk_cmd_pool_create_cmd_buffer().

◆ vk_cmd_pool_destroy()

void vk_cmd_pool_destroy ( struct vk_bundle vk,
struct vk_cmd_pool pool 
)

Destroy a command buffer pool, lock must not be held, externally synchronizable with all other pool commands.

References pool::mutex, and os_mutex::os_mutex_destroy().

Referenced by comp_swapchain_shared_destroy(), and render_resources::render_resources_close().

◆ vk_cmd_pool_end_submit_wait_and_free_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)
inline

Locks, calls vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked, and then unlocks the command pool.

Will during the call take the queue lock and release it.

References vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked(), vk_cmd_pool_lock(), and vk_cmd_pool_unlock().

◆ vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_end_submit_wait_and_free_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)
inline

A do everything submit function, will take the queue mutex.

Will create a fence and wait on the commands to complete. Will also end and destroy the passed in command buffer.

Precondition
Command pool lock must be held, see vk_cmd_pool_lock.

Calls:

  • vkEndCommandBuffer
  • vkCreateFence
  • vkWaitForFences
  • vkDestroyFence
  • vkFreeCommandBuffers

References vk_cmd_end_submit_wait_and_free_cmd_buffer_locked().

Referenced by vk_cmd_pool_end_submit_wait_and_free_cmd_buffer().

◆ vk_cmd_pool_init()

XRT_CHECK_RESULT VkResult vk_cmd_pool_init ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandPoolCreateFlags  flags 
)

Create a command buffer pool.

Referenced by comp_swapchain_shared_init().

◆ vk_cmd_pool_lock()

static void vk_cmd_pool_lock ( struct vk_cmd_pool pool)
inline

Lock the command pool, needed for creating command buffers, filling out commands on any command buffers created from this pool and submitting any command buffers created from this pool to a VkQueue.

References pool::mutex, and os_mutex::os_mutex_lock().

Referenced by vk_cmd_pool_create_and_begin_cmd_buffer(), vk_cmd_pool_create_cmd_buffer(), vk_cmd_pool_end_submit_wait_and_free_cmd_buffer(), vk_cmd_pool_submit(), and vk_cmd_pool_submit_cmd_buffer().

◆ vk_cmd_pool_submit()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit ( struct vk_bundle vk,
struct vk_cmd_pool pool,
uint32_t  count,
const VkSubmitInfo *  infos,
VkFence  fence 
)
inline

Locks, calls vk_cmd_submit_locked, and then unlocks the command pool.

Will, during the call, take the queue lock and release it.

References vk_cmd_pool_lock(), vk_cmd_pool_unlock(), and vk_cmd_submit_locked().

◆ vk_cmd_pool_submit_cmd_buffer()

static XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)
inline

Locks, calls vk_cmd_pool_submit_cmd_buffer_locked, and then unlocks the command pool.

Will during the call take the queue lock and release it.

References vk_cmd_pool_lock(), vk_cmd_pool_submit_cmd_buffer_locked(), and vk_cmd_pool_unlock().

◆ vk_cmd_pool_submit_cmd_buffer_locked()

XRT_CHECK_RESULT VkResult vk_cmd_pool_submit_cmd_buffer_locked ( struct vk_bundle vk,
struct vk_cmd_pool pool,
VkCommandBuffer  cmd_buffer 
)

Submit to the vulkan queue, will take the queue mutex.

Precondition
Command pool lock must be held, see vk_cmd_pool_lock.

References vk_cmd_submit_locked().

Referenced by vk_cmd_pool_submit_cmd_buffer().

◆ vk_cmd_pool_unlock()


The documentation for this struct was generated from the following file: