summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
authoromnisci3nce <omniscient.oce@gmail.com>2024-07-12 12:47:07 +1000
committeromnisci3nce <omniscient.oce@gmail.com>2024-07-12 12:47:07 +1000
commitf74cf52946f4e569a26bc81105537b40be95c2c7 (patch)
tree1d000367350d0e28eb7cfbc800286a0ed30a4e6c /src/render
parentfedba7ff68924ff50022405fc9103a5acf7013fe (diff)
wip: big makeover
Diffstat (limited to 'src/render')
-rw-r--r--src/render/ral_types.h153
-rw-r--r--src/render/render.h10
2 files changed, 0 insertions, 163 deletions
diff --git a/src/render/ral_types.h b/src/render/ral_types.h
index 5f21846..be95902 100644
--- a/src/render/ral_types.h
+++ b/src/render/ral_types.h
@@ -26,139 +26,6 @@ CORE_DEFINE_HANDLE(pipeline_handle);
CORE_DEFINE_HANDLE(renderpass_handle);
#define ABSENT_MODEL_HANDLE 999999999
-// gpu types
-typedef enum gpu_primitive_topology {
- CEL_PRIMITIVE_TOPOLOGY_POINT,
- CEL_PRIMITIVE_TOPOLOGY_LINE,
- CEL_PRIMITIVE_TOPOLOGY_LINE_STRIP,
- CEL_PRIMITIVE_TOPOLOGY_TRIANGLE,
- CEL_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
- CEL_PRIMITIVE_TOPOLOGY_COUNT
-} cel_primitive_topology;
-
-typedef enum gpu_texture_type {
- CEL_TEXTURE_TYPE_2D,
- CEL_TEXTURE_TYPE_3D,
- CEL_TEXTURE_TYPE_2D_ARRAY,
- CEL_TEXTURE_TYPE_CUBE_MAP,
- CEL_TEXTURE_TYPE_COUNT
-} gpu_texture_type;
-
-typedef enum gpu_texture_format {
- CEL_TEXTURE_FORMAT_8_8_8_8_RGBA_UNORM,
- CEL_TEXTURE_FORMAT_DEPTH_DEFAULT,
- CEL_TEXTURE_FORMAT_COUNT
-} gpu_texture_format;
-
-/** @brief Texture Description - used by texture creation functions */
-typedef struct texture_desc {
- gpu_texture_type tex_type;
- gpu_texture_format format;
- u32x2 extents;
-} texture_desc;
-
-typedef enum gpu_buffer_type {
- CEL_BUFFER_DEFAULT, // on Vulkan this would be a storage buffer?
- CEL_BUFFER_VERTEX,
- CEL_BUFFER_INDEX,
- CEL_BUFFER_UNIFORM,
- CEL_BUFFER_COUNT
-} gpu_buffer_type;
-
-static const char* buffer_type_names[] = {
- "RAL Buffer Default", "RAL Buffer Vertex", "RAL Buffer Index",
- "RAL Buffer Uniform", "RAL Buffer Count",
-};
-
-typedef enum gpu_buffer_flag {
- CEL_BUFFER_FLAG_CPU = 1 << 0,
- CEL_BUFFER_FLAG_GPU = 1 << 1,
- CEL_BUFFER_FLAG_STORAGE = 1 << 2,
- CEL_BUFFER_FLAG_COUNT
-} gpu_buffer_flag;
-typedef u32 gpu_buffer_flags;
-
-typedef enum vertex_format {
- VERTEX_STATIC_3D,
- VERTEX_SPRITE,
- VERTEX_SKINNED,
- VERTEX_COLOURED_STATIC_3D,
- VERTEX_RAW_POS_COLOUR,
- VERTEX_COUNT
-} vertex_format;
-
-typedef union vertex {
- struct {
- vec3 position;
- vec3 normal;
- vec2 tex_coords;
- } static_3d; /** @brief standard vertex format for static geometry in 3D */
-
- struct {
- vec2 position;
- vec4 colour;
- vec2 tex_coords;
- } sprite; /** @brief vertex format for 2D sprites or quads */
-
- struct {
- vec3 position;
- vec4 colour;
- vec2 tex_coords;
- vec3 normal;
- vec4i bone_ids; // Integer vector for bone IDs
- vec4 bone_weights; // Weight of each bone's influence
- } skinned_3d; /** @brief vertex format for skeletal (animated) geometry in 3D */
-
- struct {
- vec3 position;
- vec2 tex_coords;
- vec3 normal;
- vec4 colour;
- } coloured_static_3d; /** @brief vertex format used for debugging */
-
- struct {
- vec2 position;
- vec3 colour;
- } raw_pos_colour;
-} vertex;
-
-#ifndef TYPED_VERTEX_ARRAY
-KITC_DECL_TYPED_ARRAY(vertex)
-KITC_DECL_TYPED_ARRAY(u32)
-#define TYPED_VERTEX_ARRAY
-#endif
-
-// TEMP
-typedef struct custom_vertex {
- vec2 pos;
- vec3 color;
-} custom_vertex;
-
-// Vertex attributes
-/// @strip_prefix(ATTR_)
-typedef enum vertex_attrib_type {
- ATTR_F32,
- ATTR_F32x2,
- ATTR_F32x3,
- ATTR_F32x4,
- ATTR_U32,
- ATTR_U32x2,
- ATTR_U32x3,
- ATTR_U32x4,
- ATTR_I32,
- ATTR_I32x2,
- ATTR_I32x3,
- ATTR_I32x4,
-} vertex_attrib_type;
-
-typedef struct vertex_description {
- char* debug_label;
- const char* attr_names[MAX_VERTEX_ATTRIBUTES];
- vertex_attrib_type attributes[MAX_VERTEX_ATTRIBUTES];
- u32 attributes_count;
- size_t stride;
- bool use_full_vertex_size;
-} vertex_description;
// --- Shaders & Bindings
@@ -218,32 +85,12 @@ typedef struct shader_binding {
} data; /** @brief can store any kind of data that we can bind to a shader / descriptor set */
} shader_binding;
-#define MAX_LAYOUT_BINDINGS 8
void print_shader_binding(shader_binding b);
/** @brief A list of bindings that describe what data a shader / pipeline expects
@note This roughly correlates to a descriptor set layout in Vulkan
*/
-typedef struct shader_data_layout {
- char* name;
- shader_binding bindings[MAX_LAYOUT_BINDINGS];
- u32 bindings_count;
-} shader_data_layout;
-
-typedef struct shader_data {
- shader_data_layout (*shader_data_get_layout)(void* data);
- void* data;
-} shader_data;
-
-/*
- Usage:
- 1. When we create the pipeline, we must call a function that return a layout without .data
- fields
- 2. When binding
-*/
-
-typedef enum gpu_cull_mode { CULL_BACK_FACE, CULL_FRONT_FACE, CULL_COUNT } gpu_cull_mode;
// ? How to tie together materials and shaders
diff --git a/src/render/render.h b/src/render/render.h
index 19a8d1a..f0e9a64 100644
--- a/src/render/render.h
+++ b/src/render/render.h
@@ -69,11 +69,6 @@ texture_handle texture_data_upload(texture_data data, bool free_on_upload);
material pbr_material_load(char* albedo_path, char* normal_path, bool metal_roughness_combined,
char* metallic_path, char* roughness_map, char* ao_map);
-buffer_handle buffer_create(const char* debug_name, u64 size);
-bool buffer_destroy(buffer_handle buffer);
-sampler_handle sampler_create();
-
-// models and meshes are implemented **in terms of the above**
/**
* @brief Creates buffers and returns a struct that holds handles to our resources
@@ -89,8 +84,3 @@ void mesh_delete(mesh* mesh); // TODO
void draw_mesh(mesh* mesh, mat4* model, camera* cam);
model_handle model_load(const char* debug_name, const char* filepath);
-
-void geo_free_data(geometry_data* geo);
-void geo_set_vertex_colours(geometry_data* geo, vec4 colour);
-
-vertex_description static_3d_vertex_description();