summaryrefslogtreecommitdiff
path: root/src/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/backends/backend_vulkan.c15
-rw-r--r--src/renderer/cleanroom/README.md1
-rw-r--r--src/renderer/cleanroom/types.h63
-rw-r--r--src/renderer/render_types.h3
4 files changed, 71 insertions, 11 deletions
diff --git a/src/renderer/backends/backend_vulkan.c b/src/renderer/backends/backend_vulkan.c
index c57da9d..d78d4d2 100644
--- a/src/renderer/backends/backend_vulkan.c
+++ b/src/renderer/backends/backend_vulkan.c
@@ -173,20 +173,15 @@ typedef struct vulkan_state {
} vulkan_state;
// pipeline stuff
-bool vulkan_graphics_pipeline_create(
- vulkan_context* context,
- vulkan_renderpass* renderpass,
- u32 attribute_count,
- VkVertexInputAttributeDescription* attributes,
- // ... https://youtu.be/OmPmftW7Kjg?si=qn_777v_ppHKzswK&t=568
-) {
-
-}
+bool vulkan_graphics_pipeline_create(vulkan_context* context, vulkan_renderpass* renderpass,
+ u32 attribute_count,
+ VkVertexInputAttributeDescription* attributes,
+ // ... https://youtu.be/OmPmftW7Kjg?si=qn_777v_ppHKzswK&t=568
+) {}
bool create_shader_module(vulkan_context* context, const char* filename, const char* type_str,
VkShaderStageFlagBits flag, u32 stage_index,
vulkan_shader_stage* shader_stages) {
-
memset(&shader_stages[stage_index].create_info, 0, sizeof(VkShaderModuleCreateInfo));
memset(&shader_stages[stage_index].stage_create_info, 0, sizeof(VkPipelineShaderStageCreateInfo));
diff --git a/src/renderer/cleanroom/README.md b/src/renderer/cleanroom/README.md
new file mode 100644
index 0000000..d510f16
--- /dev/null
+++ b/src/renderer/cleanroom/README.md
@@ -0,0 +1 @@
+# Cleanroom / Re-jig of the renderer structure \ No newline at end of file
diff --git a/src/renderer/cleanroom/types.h b/src/renderer/cleanroom/types.h
new file mode 100644
index 0000000..cd51fca
--- /dev/null
+++ b/src/renderer/cleanroom/types.h
@@ -0,0 +1,63 @@
+#pragma once
+#include "defines.h"
+
+typedef int texture_handle;
+typedef int buffer_handle;
+typedef int model_handle;
+
+/** @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;
+
+/*
+ - render_types.h
+ - ral_types.h
+ - ral.h
+ - render.h ?
+*/
+
+/* render_types */
+typedef struct mesh mesh;
+typedef struct model model;
+typedef struct model pbr_material;
+typedef struct model bp_material; // blinn-phong
+
+// Three registers
+// 1. low level graphics api calls "ral"
+// 2. higher level render calls
+// 3. simplified immediate mode API
+
+/* render.h */
+// frontend -- these can be called from say a loop in an example, or via FFI
+texture_handle texture_create(const char* debug_name, texture_desc description);
+void texture_data_upload(texture_handle texture);
+buffer_handle buffer_create(const char* debug_name, u64 size);
+
+// models and meshes are implemented **in terms of the above**
+mesh mesh_create();
+model_handle model_load(const char* filepath);
+
+/* ral.h */
+// backend -- these are not seen by the higher-level code
+void gpu_texture_init();
+void gpu_texture_upload();
+void gpu_buffer_init();
+void gpu_buffer_upload();
+
+// command buffer gubbins
+
+// 3. SIMA (simplified immediate mode api)
+// - dont need to worry about uploading mesh data
+void debug_draw_cuboid();
+void debug_draw_sphere();
+void debug_draw_camera_frustum();
+static void imm_draw_model(const char* model_filepath); // tracks internally whether the model is loaded
+
+static void imm_draw_model(const char* model_filepath) {
+ // check that model is loaded
+ // if not loaded, load model and upload to gpu - LRU cache for models
+ // else submit draw call
+} \ No newline at end of file
diff --git a/src/renderer/render_types.h b/src/renderer/render_types.h
index 7bb6e60..2cc321c 100644
--- a/src/renderer/render_types.h
+++ b/src/renderer/render_types.h
@@ -8,6 +8,7 @@
#pragma once
#include "darray.h"
+#include "maths.h"
#include "maths_types.h"
#include "str.h"
@@ -178,4 +179,4 @@ typedef enum gpu_texture_format {
TEXTURE_FORMAT_8_8_8_8_RGBA_UNORM,
TEXTURE_FORMAT_DEPTH_DEFAULT,
TEXTURE_FORMAT_COUNT
-} gpu_texture_format;
+} gpu_texture_format; \ No newline at end of file