Refactoring
Cleaned up a project, removed uneccessary includes. Fixed few errors, nothing major.
This commit is contained in:
1 parent
42dc4d6fcd
commit
1f585b4d8e
20 files changed
+22
-54
No files matched your search
@@ -40,3 +40,7 @@ bin/*
|
|||||||
|
|
||||||
# Third party libraires
|
# Third party libraires
|
||||||
third_party/
|
third_party/
|
||||||
|
|
||||||
|
# Cache folder
|
||||||
|
.cache/
|
||||||
|
|
||||||
+1
-23
@@ -4,33 +4,11 @@ project("RedScarfEngine"
|
|||||||
DESCRIPTION "Vulkan based 3D engine"
|
DESCRIPTION "Vulkan based 3D engine"
|
||||||
LANGUAGES C CXX)
|
LANGUAGES C CXX)
|
||||||
|
|
||||||
|
set(CMAKE_C_STANDARD 23)
|
||||||
# make sure c++ 20 is set
|
|
||||||
set(CMAKE_CXX_STANDARD 20)# turn on the dynamic depends for ninja
|
|
||||||
set(CMAKE_C_STANDARD 23)# turn on the dynamic depends for ninja
|
|
||||||
# set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
|
|
||||||
# Enable C++ modules
|
|
||||||
# set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "3c375311-a3c9-4396-a187-3227ef642046")
|
|
||||||
|
|
||||||
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
# include(gcc_modules.cmake)
|
|
||||||
# endif()
|
|
||||||
|
|
||||||
# string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE
|
|
||||||
# "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> <SOURCE>"
|
|
||||||
# " -MT <DYNDEP_FILE> -MD -MF <DEP_FILE>"
|
|
||||||
# " ${flags_to_scan_deps} -fdep-file=<DYNDEP_FILE> -fdep-output=<OBJECT>"
|
|
||||||
# )
|
|
||||||
|
|
||||||
# set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "gcc")
|
|
||||||
# set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG
|
|
||||||
# "${compiler_flags_for_module_map} -fmodule-mapper=<MODULE_MAP_FILE>")
|
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(red_scarf_engine)
|
add_subdirectory(red_scarf_engine)
|
||||||
add_subdirectory(utilities)
|
add_subdirectory(utilities)
|
||||||
add_subdirectory(graphics)
|
add_subdirectory(graphics)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ rse_err_t rse_graphics_init(void)
|
|||||||
void rse_graphics_test_function(void)
|
void rse_graphics_test_function(void)
|
||||||
{
|
{
|
||||||
rse_err_t status = RSE_ERROR_NO_ERROR;
|
rse_err_t status = RSE_ERROR_NO_ERROR;
|
||||||
uint8_t tex_id_2 = 0;
|
uint16_t tex_id_2 = 0;
|
||||||
|
|
||||||
status = rse_load_texture("../../test_image.png", &tex_id_2);
|
status = rse_load_texture("../../test_image.png", &tex_id_2);
|
||||||
if (status != RSE_ERROR_NO_ERROR) {
|
if (status != RSE_ERROR_NO_ERROR) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "rse_vulkan_commands.h"
|
#include "rse_vulkan_commands.h"
|
||||||
|
|
||||||
|
#include "vulkan_commons.h"
|
||||||
#include "vulkan_errors.h"
|
#include "vulkan_errors.h"
|
||||||
#include "locale_vulkan.h"
|
#include "locale_vulkan.h"
|
||||||
#include "utilities/logger.h"
|
#include "utilities/logger.h"
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#ifndef RSE_VULKAN_COMMANDS_H
|
#ifndef RSE_VULKAN_COMMANDS_H
|
||||||
#define RSE_VULKAN_COMMANDS_H
|
#define RSE_VULKAN_COMMANDS_H
|
||||||
|
|
||||||
#include "vulkan_commons.h"
|
|
||||||
#include "vk_mem_alloc.h"
|
#include "vk_mem_alloc.h"
|
||||||
#include "utilities/rse_commons.h"
|
#include "utilities/rse_commons.h"
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#define IMAGE_TAKEN 1U
|
#define IMAGE_TAKEN 1U
|
||||||
#define IMAGE_FREE 0U
|
#define IMAGE_FREE 0U
|
||||||
@@ -208,7 +207,7 @@ static rse_err_t create_vulkan_image(uint32_t width,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
VkFormat format,
|
VkFormat format,
|
||||||
unsigned char* pixels,
|
unsigned char* pixels,
|
||||||
uint8_t* texture_id)
|
uint16_t* texture_id)
|
||||||
{
|
{
|
||||||
rse_err_t status = RSE_ERROR_NO_ERROR;
|
rse_err_t status = RSE_ERROR_NO_ERROR;
|
||||||
struct rse_vulkan_buffer_t staging_buffer = {0};
|
struct rse_vulkan_buffer_t staging_buffer = {0};
|
||||||
@@ -222,9 +221,10 @@ static rse_err_t create_vulkan_image(uint32_t width,
|
|||||||
VkExtent3D image_extent = {0};
|
VkExtent3D image_extent = {0};
|
||||||
VkImageViewCreateInfo image_view_create_info = {0};
|
VkImageViewCreateInfo image_view_create_info = {0};
|
||||||
struct rse_vulkan_image_t* free_texture_image = NULL;
|
struct rse_vulkan_image_t* free_texture_image = NULL;
|
||||||
|
|
||||||
*texture_id = 0U;
|
*texture_id = 0U;
|
||||||
|
|
||||||
while(free_texture_image == NULL || *texture_id > RSE_MAX_IMAGE_COUNT) {
|
while(free_texture_image == NULL && *texture_id < RSE_MAX_IMAGE_COUNT) {
|
||||||
if(g_texture_images[*texture_id].id_taken == IMAGE_FREE) {
|
if(g_texture_images[*texture_id].id_taken == IMAGE_FREE) {
|
||||||
free_texture_image = &g_texture_images[*texture_id];
|
free_texture_image = &g_texture_images[*texture_id];
|
||||||
} else {
|
} else {
|
||||||
@@ -399,7 +399,7 @@ rse_err_t init_vulkan_images()
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
rse_err_t rse_load_texture(const char* file_path, uint8_t* texture_id)
|
rse_err_t rse_load_texture(const char* file_path, uint16_t* texture_id)
|
||||||
{
|
{
|
||||||
rse_err_t status = RSE_ERROR_NO_ERROR;
|
rse_err_t status = RSE_ERROR_NO_ERROR;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
|
|
||||||
#include "utilities/file_utils.h"
|
#include "utilities/file_utils.h"
|
||||||
#include "utilities/rse_commons.h"
|
#include "utilities/rse_commons.h"
|
||||||
#include "vulkan_commons.h"
|
|
||||||
|
#include "vulkan/vulkan_core.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ rse_err_t init_vulkan_images(void);
|
|||||||
* @param texture_id Texture ID will be set up here
|
* @param texture_id Texture ID will be set up here
|
||||||
* @return rse_err_t RSE_ERROR_NO_ERROR on success
|
* @return rse_err_t RSE_ERROR_NO_ERROR on success
|
||||||
*/
|
*/
|
||||||
rse_err_t rse_load_texture(const char* file_path, uint8_t* texture_id);
|
rse_err_t rse_load_texture(const char* file_path, uint16_t* texture_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy all loaded textures. Usefull for closing application or just clearing.
|
* @brief Destroy all loaded textures. Usefull for closing application or just clearing.
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
// #pragma GCC diagnostic pop
|
// #pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include "locale_vulkan.h"
|
#include "locale_vulkan.h"
|
||||||
#include "utilities/locale_common.h"
|
|
||||||
#include "utilities/rse_errors_common.h"
|
#include "utilities/rse_errors_common.h"
|
||||||
#include "utilities/logger.h"
|
#include "utilities/logger.h"
|
||||||
#include "vulkan_errors.h"
|
#include "vulkan_errors.h"
|
||||||
@@ -345,7 +344,7 @@ static rse_err_t pick_physical_device()
|
|||||||
vkEnumeratePhysicalDevices(g_vulkan_instance, &physical_device_count, NULL);
|
vkEnumeratePhysicalDevices(g_vulkan_instance, &physical_device_count, NULL);
|
||||||
|
|
||||||
if (0 == physical_device_count) {
|
if (0 == physical_device_count) {
|
||||||
LOGF(vulkan_messages[VULKAN_ERROR_NO_PHYSICAL_DEVICE_FOUND]);
|
LOGF(vulkan_messages[VULKAN_NO_PHYSICAL_DEVICES]);
|
||||||
return VULKAN_ERROR_NO_PHYSICAL_DEVICE_FOUND;
|
return VULKAN_ERROR_NO_PHYSICAL_DEVICE_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,7 +526,7 @@ static rse_err_t create_memory_allocator()
|
|||||||
allocator_create_info.pVulkanFunctions = &vulkan_functions;
|
allocator_create_info.pVulkanFunctions = &vulkan_functions;
|
||||||
|
|
||||||
if (VK_SUCCESS != vmaCreateAllocator(&allocator_create_info, &g_vulkan_state.allocator)) {
|
if (VK_SUCCESS != vmaCreateAllocator(&allocator_create_info, &g_vulkan_state.allocator)) {
|
||||||
LOGF(vulkan_messages[VULKAN_ERROR_ALLOCATOR_CREATION_FAILED]);
|
LOGF(vulkan_messages[VULKAN_ALLOCATOR_CREATION_FAILED]);
|
||||||
return VULKAN_ERROR_ALLOCATOR_CREATION_FAILED;
|
return VULKAN_ERROR_ALLOCATOR_CREATION_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,8 @@
|
|||||||
#ifndef RSE_GRAPHICS_VULKANBASE_H
|
#ifndef RSE_GRAPHICS_VULKANBASE_H
|
||||||
#define RSE_GRAPHICS_VULKANBASE_H
|
#define RSE_GRAPHICS_VULKANBASE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
#include "vulkan_commons.h"
|
|
||||||
#include "utilities/rse_commons.h"
|
#include "utilities/rse_commons.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "locale_vulkan.h"
|
#include "locale_vulkan.h"
|
||||||
#include "utilities/logger.h"
|
#include "utilities/logger.h"
|
||||||
#include "utilities/rse_errors_common.h"
|
#include "utilities/rse_errors_common.h"
|
||||||
#include "mesh_controller.h"
|
|
||||||
#include "rse_math.h"
|
#include "rse_math.h"
|
||||||
#include "rse_vulkan_commands.h"
|
#include "rse_vulkan_commands.h"
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
#include "vulkan_commons.h"
|
#include "vulkan_commons.h"
|
||||||
#include "rse_vulkan_image.h"
|
#include "rse_vulkan_image.h"
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
|
||||||
|
|
||||||
|
|
||||||
VkDescriptorPool gDescriptorPool;
|
VkDescriptorPool gDescriptorPool;
|
||||||
VkDescriptorPool gDescriptorPool_bindless;
|
VkDescriptorPool gDescriptorPool_bindless;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef RSE_VULKAN_DESCRIPTORS_H
|
#ifndef RSE_VULKAN_DESCRIPTORS_H
|
||||||
#define RSE_VULKAN_DESCRIPTORS_H
|
#define RSE_VULKAN_DESCRIPTORS_H
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "utilities/rse_commons.h"
|
#include "utilities/rse_commons.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,9 @@
|
|||||||
#include "utilities/logger.h"
|
#include "utilities/logger.h"
|
||||||
#include "utilities/rse_errors_common.h"
|
#include "utilities/rse_errors_common.h"
|
||||||
#include "vulkan_errors.h"
|
#include "vulkan_errors.h"
|
||||||
#include "mesh_controller.h"
|
|
||||||
#include "rse_vulkan_image.h"
|
#include "rse_vulkan_image.h"
|
||||||
#include "vulkan_descriptors.h"
|
#include "vulkan_descriptors.h"
|
||||||
|
#include "vulkan_commons.h"
|
||||||
#include "vulkan/vulkan.h"
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
#ifndef RSE_VULKAN_PIPELINE_H
|
#ifndef RSE_VULKAN_PIPELINE_H
|
||||||
#define RSE_VULKAN_PIPELINE_H
|
#define RSE_VULKAN_PIPELINE_H
|
||||||
|
|
||||||
#include "vulkan_commons.h"
|
|
||||||
#include "utilities/rse_commons.h"
|
#include "utilities/rse_commons.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a graphics pipeline
|
* @brief Create a graphics pipeline
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
#include "locale_window.h"
|
#include "locale_window.h"
|
||||||
|
#include "rse_window_errors.h"
|
||||||
#include "utilities/logger.h"
|
#include "utilities/logger.h"
|
||||||
#include "utilities/rse_errors_common.h"
|
#include "utilities/rse_errors_common.h"
|
||||||
#include "vulkan_base.h"
|
#include "vulkan_base.h"
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
/* Vulkan header MUST be included before glfw */
|
/* Vulkan header MUST be included before glfw */
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#include "rse_window_errors.h"
|
|
||||||
#include "utilities/rse_commons.h"
|
#include "utilities/rse_commons.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ int main(int argc, char** argv)
|
|||||||
rse_task_join(&graphics_task);
|
rse_task_join(&graphics_task);
|
||||||
rse_task_exit();
|
rse_task_exit();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
#include "criterion/criterion.h"
|
#include "criterion/criterion.h"
|
||||||
#include "graphics/src/rse_math.h"
|
#include "graphics/src/rse_math.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
/*-----------------RSE MATH TEST------------------------*/
|
/*-----------------RSE MATH TEST------------------------*/
|
||||||
|
|
||||||
TestSuite(rse_math);
|
TestSuite(rse_math);
|
||||||
@@ -177,6 +173,7 @@ Test(rse_math, perspective)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------RSE TEXTURES TEST------------------------*/
|
/*-----------------RSE TEXTURES TEST------------------------*/
|
||||||
|
|
||||||
#include "graphics/src/rse_texture.h"
|
#include "graphics/src/rse_texture.h"
|
||||||
TestSuite(rse_textures);
|
TestSuite(rse_textures);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#ifndef RSE_COMMONS_H
|
#ifndef RSE_COMMONS_H
|
||||||
#define RSE_COMMONS_H
|
#define RSE_COMMONS_H
|
||||||
|
|
||||||
|
#include "utilities/locale_common.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user