/**
 * @file vulkan_commands.h
 * @author Piotr Krygier (everyonecancode@gmail.com)
 * @brief Vukan Commands allocation and execution
 * @version 0.1
 * @date 2023-09-29
 *
 * @copyright Copyright (c) 2023
 *
 */

#ifndef VULKAN_COMMANDS_H
#define VULKAN_COMMANDS_H

#include <vma/vk_mem_alloc.h>
#include <vulkan/vulkan_core.h>

#include "utilities/commons.h"
#include "graphics_context.h"

/**
 * @brief Initialize vulkan commands pools and sets
 *
 * @param context Graphics context handle
 * @return rse_err_t RSE_ERROR_NO_ERROR on success
 */
rse_err_t init_commands(struct graphics_context_t* context);

/**
 * @brief Destroy vulkan commands sets and pools
 *
 * @param context Graphics context handle
 *
 */
void destroy_commands(struct graphics_context_t* context);

/**
 * @brief Helper function, creates command buffer for recording a command. Useful for copying buffer na images.
 *
 * @param context Graphics context handle
 * @return RSE_ERROR_NO_ERROR on success
 */
rse_err_t begin_single_time_command(struct graphics_context_t* context, VkCommandBuffer* command_buffer);

/**
 * @brief Close command buffer and execute recorded command.
 *
 * @param context Graphics context handle
 * @param command_buffer Command buffer for execution
 * @return RSE_ERROR_NO_ERROR on success
 */
rse_err_t end_single_time_comands(struct graphics_context_t* context, VkCommandBuffer command_buffer);

#endif /* VULKAN_COMMANDS_H */
