summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/defines.h3
-rw-r--r--src/logos/jobs.h3
-rw-r--r--src/logos/tasks.h60
-rw-r--r--src/new_render/render.h4
-rw-r--r--src/ral/backends/vulkan/backend_vulkan.c0
-rw-r--r--src/ral/backends/vulkan/backend_vulkan.h44
-rw-r--r--src/ral/backends/vulkan/vulkan_glossary.md (renamed from src/render/backends/vulkan/vulkan_glossary.md)0
-rw-r--r--src/ral/backends/vulkan/vulkan_helpers.h (renamed from src/render/backends/vulkan_helpers.h)0
-rw-r--r--src/ral/ral_impl.h9
9 files changed, 118 insertions, 5 deletions
diff --git a/src/defines.h b/src/defines.h
index 1f0eae7..2edba8a 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -68,5 +68,6 @@ CORE_DEFINE_HANDLE(Handle); // Untyped handle that can be casted to a strongly t
#if defined(CEL_PLATFORM_MAC)
// #define CEL_REND_BACKEND_METAL 1
-#define CEL_REND_BACKEND_OPENGL 1
+// #define CEL_REND_BACKEND_OPENGL 1
+#define CEL_REND_BACKEND_VULKAN 1
#endif
diff --git a/src/logos/jobs.h b/src/logos/jobs.h
deleted file mode 100644
index ef4eed7..0000000
--- a/src/logos/jobs.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/**
- * Common jobs that get run
- */ \ No newline at end of file
diff --git a/src/logos/tasks.h b/src/logos/tasks.h
new file mode 100644
index 0000000..3e6bd06
--- /dev/null
+++ b/src/logos/tasks.h
@@ -0,0 +1,60 @@
+/**
+ * Common jobs that get run
+ */
+#pragma once
+#include "defines.h"
+#include "logos/threadpool.h"
+#include "render_types.h"
+#include "str.h"
+
+typedef struct Task {
+ char* debug_name;
+ void* params;
+ bool is_done;
+} Task;
+
+// Macro : give Params and Result structs and it creates a function that knows
+// correct sizes
+
+typedef struct Task_ModelLoad_Params {
+ Str8 filepath; // filepath to the model on disk
+ } Task_ModelLoad_Params;
+typedef struct Task_ModelLoad_Result {
+ Model model;
+} Task_ModelLoad_Result;
+
+// Internally it will allocate data for each
+
+static bool Task_ModelLoad_Typed(
+ Task_ModelLoad_Params* params,
+ Task_ModelLoad_Result* result,
+ tpool_task_start run_task,
+ tpool_task_on_complete on_success,
+ tpool_task_on_complete on_failure
+) {
+ threadpool_add_task(pool, , tpool_task_on_complete on_success, tpool_task_on_complete on_fail, bool buffer_result_for_main_thread, void *param_data, u32 param_data_size, u32 result_data_size)
+}
+
+// do task
+// success
+void model_load_success(task_globals* globals, void* result) {
+ Task_ModelLoad_Result* load_res = result;
+
+ // push into render -> renderables ?
+}
+// fail
+
+
+// we can define our custom task here that wraps the more verbose function pointers
+static Task Task_ModelLoad(
+ Task_ModelLoad_Params* params,
+ Task_ModelLoad_Result* result
+) {
+ Task task;
+ task.debug_name = "Load Model";
+ task.params = params;
+
+ Task_ModelLoad_Typed(params, result, tpool_task_start run_task, tpool_task_on_complete on_success, tpool_task_on_complete on_failure)
+
+ return task;
+}
diff --git a/src/new_render/render.h b/src/new_render/render.h
index de84eda..718ac3e 100644
--- a/src/new_render/render.h
+++ b/src/new_render/render.h
@@ -16,6 +16,10 @@ typedef struct RendererConfig {
Vec3 clear_colour;
} RendererConfig;
+typedef struct RenderFlags {
+ bool wireframe;
+} RenderFlags;
+
typedef struct RenderCtx {
Mat4 view;
Mat4 projection;
diff --git a/src/ral/backends/vulkan/backend_vulkan.c b/src/ral/backends/vulkan/backend_vulkan.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/ral/backends/vulkan/backend_vulkan.c
diff --git a/src/ral/backends/vulkan/backend_vulkan.h b/src/ral/backends/vulkan/backend_vulkan.h
index e69de29..790344b 100644
--- a/src/ral/backends/vulkan/backend_vulkan.h
+++ b/src/ral/backends/vulkan/backend_vulkan.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#ifdef CEL_REND_BACKEND_VULKAN
+#include "ral_impl.h"
+#include "defines.h"
+#include "maths_types.h"
+#include "ral.h"
+#include "ral_types.h"
+
+#include <vulkan/vk_platform.h>
+#include <vulkan/vulkan.h>
+#include <vulkan/vulkan_core.h>
+
+// Provide definitions for RAL structs
+
+struct GPU_Swapchain {
+ VkSwapchainKHR handle;
+};
+
+struct GPU_Device {
+ VkPhysicalDevice physical_device;
+ VkDevice logical_device;
+};
+
+struct GPU_PipelineLayout {};
+ struct GPU_Pipeline {};
+ struct GPU_Renderpass {};
+ struct GPU_CmdEncoder {};
+ struct GPU_CmdBuffer {};
+ struct GPU_Buffer {
+ VkBuffer handle;
+ VkDeviceMemory memory;
+ u64 size;
+ };
+ struct GPU_Texture {
+ VkImage handle;
+ VkDeviceMemory memory;
+ u64 size;
+ VkImageView view;
+ VkSampler sampler;
+ char* debug_label;
+ };
+
+#endif
diff --git a/src/render/backends/vulkan/vulkan_glossary.md b/src/ral/backends/vulkan/vulkan_glossary.md
index 4214f9d..4214f9d 100644
--- a/src/render/backends/vulkan/vulkan_glossary.md
+++ b/src/ral/backends/vulkan/vulkan_glossary.md
diff --git a/src/render/backends/vulkan_helpers.h b/src/ral/backends/vulkan/vulkan_helpers.h
index 23666c6..23666c6 100644
--- a/src/render/backends/vulkan_helpers.h
+++ b/src/ral/backends/vulkan/vulkan_helpers.h
diff --git a/src/ral/ral_impl.h b/src/ral/ral_impl.h
index 9343962..7b40f28 100644
--- a/src/ral/ral_impl.h
+++ b/src/ral/ral_impl.h
@@ -77,4 +77,11 @@ PUB void GPU_EncodeDrawIndexed(GPU_CmdEncoder* encoder, u64 index_count);
// --- Frame cycle
PUB bool GPU_Backend_BeginFrame();
-PUB void GPU_Backend_EndFrame(); \ No newline at end of file
+PUB void GPU_Backend_EndFrame();
+
+// Concrete implementation
+#if defined(CEL_REND_BACKEND_OPENGL)
+#include "backend_opengl.h"
+#elif defined(CEL_REND_BACKEND_VULKAN)
+#include "backend_vulkan.h"
+#endif