Kohi Game Engine
vulkan_command_buffer.h File Reference

Represents a command buffer, which is used to hold commands to be executed by a Vulkan queue. More...

#include "vulkan_types.h"

Go to the source code of this file.

Functions

void vulkan_command_buffer_allocate (vulkan_context *context, VkCommandPool pool, b8 is_primary, vulkan_command_buffer *out_command_buffer)
 Allocates a new command buffer from the given pool. More...
 
void vulkan_command_buffer_free (vulkan_context *context, VkCommandPool pool, vulkan_command_buffer *command_buffer)
 Frees the given command buffer and returns it to the provided pool. More...
 
void vulkan_command_buffer_begin (vulkan_command_buffer *command_buffer, b8 is_single_use, b8 is_renderpass_continue, b8 is_simultaneous_use)
 Begins the provided command buffer. More...
 
void vulkan_command_buffer_end (vulkan_command_buffer *command_buffer)
 Ends the given command buffer. More...
 
void vulkan_command_buffer_update_submitted (vulkan_command_buffer *command_buffer)
 Sets the command buffer to the submitted state. More...
 
void vulkan_command_buffer_reset (vulkan_command_buffer *command_buffer)
 Resets the command buffer to the ready state. More...
 
void vulkan_command_buffer_allocate_and_begin_single_use (vulkan_context *context, VkCommandPool pool, vulkan_command_buffer *out_command_buffer)
 Allocates and begins recording to out_command_buffer. More...
 
void vulkan_command_buffer_end_single_use (vulkan_context *context, VkCommandPool pool, vulkan_command_buffer *command_buffer, VkQueue queue)
 Ends recording, submits to and waits for queue operation and frees the provided command buffer. More...
 

Detailed Description

Represents a command buffer, which is used to hold commands to be executed by a Vulkan queue.

Author
Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
Version
1.0
Date
2022-01-11

Function Documentation

◆ vulkan_command_buffer_allocate()

void vulkan_command_buffer_allocate ( vulkan_context context,
VkCommandPool  pool,
b8  is_primary,
vulkan_command_buffer out_command_buffer 
)

Allocates a new command buffer from the given pool.

Parameters
contextA pointer to the Vulkan context.
poolThe pool to allocate a command buffer from.
is_primaryIndicates if the command buffer is a primary or secondary buffer.
out_command_bufferA pointer to hold the newly allocated command buffer.

◆ vulkan_command_buffer_allocate_and_begin_single_use()

void vulkan_command_buffer_allocate_and_begin_single_use ( vulkan_context context,
VkCommandPool  pool,
vulkan_command_buffer out_command_buffer 
)

Allocates and begins recording to out_command_buffer.

Parameters
contextA pointer to the Vulkan context.
poolThe pool to obtain a command buffer from.
out_command_bufferA pointer to hold the allocated command buffer.

◆ vulkan_command_buffer_begin()

void vulkan_command_buffer_begin ( vulkan_command_buffer command_buffer,
b8  is_single_use,
b8  is_renderpass_continue,
b8  is_simultaneous_use 
)

Begins the provided command buffer.

Parameters
command_bufferA pointer to the command buffer to begin.
is_single_useIndicates if the buffer is just single use.
is_renderpass_continueIndicates if the buffer is renderpass continue.
is_simultaneous_useIndicates if the buffer is simultaneous use.

◆ vulkan_command_buffer_end()

void vulkan_command_buffer_end ( vulkan_command_buffer command_buffer)

Ends the given command buffer.

Parameters
command_bufferA pointer to the command buffer to end.

◆ vulkan_command_buffer_end_single_use()

void vulkan_command_buffer_end_single_use ( vulkan_context context,
VkCommandPool  pool,
vulkan_command_buffer command_buffer,
VkQueue  queue 
)

Ends recording, submits to and waits for queue operation and frees the provided command buffer.

Parameters
contextA pointer to the Vulkan context.
poolThe pool to return a command buffer to.
command_bufferA pointer to the command buffer to be returned.
queueThe queue to submit to.

◆ vulkan_command_buffer_free()

void vulkan_command_buffer_free ( vulkan_context context,
VkCommandPool  pool,
vulkan_command_buffer command_buffer 
)

Frees the given command buffer and returns it to the provided pool.

Parameters
contextA pointer to the Vulkan context.
poolThe pool to return the command buffer to.
command_bufferThe command buffer to be returned.

◆ vulkan_command_buffer_reset()

void vulkan_command_buffer_reset ( vulkan_command_buffer command_buffer)

Resets the command buffer to the ready state.

Parameters
command_bufferA pointer to the command buffer whose state should be set.

◆ vulkan_command_buffer_update_submitted()

void vulkan_command_buffer_update_submitted ( vulkan_command_buffer command_buffer)

Sets the command buffer to the submitted state.

Parameters
command_bufferA pointer to the command buffer whose state to set.