Refactor project

Crealned up some TODOs, FIXMEs etc. Added better error handling. Looks
better, feels better.
This commit is contained in:
Piotr Krygier committed 2023-10-10 10:46:12 +02:00
1 parent bd4dd74881
commit 42dc4d6fcd
29 files changed
+750 -645

No files matched your search

+12 -10
View File
@@ -2,6 +2,8 @@
#define RSE_VULKAN_BUFFERS_H
#include "vulkan_commons.h"
#include "utilities/rse_commons.h"
#include "vk_mem_alloc.h"
#include <stdint.h>
@@ -21,9 +23,9 @@ struct rse_buffer_data_t
/**
* @brief Create buffers needed by vulkan pipeline
*
* @return uint8_t
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
uint8_t create_buffers();
rse_err_t create_buffers();
/**
* @brief Update uniform buffers
@@ -38,9 +40,9 @@ void update_uniform_buffers();
* @param indices Indices to add
* @param vertex_data Mutable vertex data. Count will be read and buffer offset will be set
* @param index_data Mutable index data. Count will be read and buffer offset will be set
* @return uint8_t
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
uint8_t rse_add_vertices(uint16_t mesh_id,
rse_err_t rse_add_vertices(uint16_t mesh_id,
const struct rse_vertex_t* vertices,
const uint16_t* indices,
struct rse_buffer_data_t* vertex_data,
@@ -51,18 +53,18 @@ uint8_t rse_add_vertices(uint16_t mesh_id,
*
* @param mesh_id Mesh ID
* @param instance_data Instance data
* @return uint8_t VULKAN_ERROR_NO_ERROR on success
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
uint8_t update_mesh_instances(uint16_t mesh_id, struct rse_instance_data_t* instance_data);
rse_err_t update_mesh_instances(uint16_t mesh_id, struct rse_instance_data_t* instance_data);
/**
* @brief Record commands for given image index
*
* @param vulkan_state
* @param imageIndex
* @return uint8_t VULKAN_ERROR_NO_ERROR on success
* @return rse_err_t RSE_ERROR_NO_ERROR on success
*/
uint8_t record_command_buffer(uint32_t imageIndex);
rse_err_t record_command_buffer(uint32_t imageIndex);
/**
* @brief Reset command buffer for current frame.
@@ -87,10 +89,10 @@ void destroy_buffers();
* @param memory_usage memory usage flags (mostly VMA_MEMORY_USAGE_AUTO)
* @param allocation_flags VMA allocation flags
* @param buffer Buffer, that will be allocated
* @return uint8_t VULKAN_ERROR_NO_ERROR on success. Possible errors:
* @return rse_err_t RSE_ERROR_NO_ERROR on success. Possible errors:
* VULKAN_ERROR_COMMAND_BUFFER_ALLOCATION_FAILED
*/
uint8_t create_buffer(const VkDeviceSize size,
rse_err_t create_buffer(const VkDeviceSize size,
VkBufferUsageFlags buffer_usage,
VmaMemoryUsage memory_usage,
const VmaAllocationCreateFlags allocation_flags,