summaryrefslogtreecommitdiff
path: root/src/ral/ral_common.h
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-09 23:32:33 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-09 23:32:33 +1000
commit3103f383751a12f8a0bdb22309704f1f826d204c (patch)
tree7da8febddfcc40b15de5d7fc3c9a5215d88c5cab /src/ral/ral_common.h
parentd5f22a65ab12b289d80b035e45e6f1e9460b82d1 (diff)
wip: some cleanup of ral
Diffstat (limited to 'src/ral/ral_common.h')
-rw-r--r--src/ral/ral_common.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/ral/ral_common.h b/src/ral/ral_common.h
new file mode 100644
index 0000000..bc86945
--- /dev/null
+++ b/src/ral/ral_common.h
@@ -0,0 +1,45 @@
+#pragma once
+#include "defines.h"
+#include "mem.h"
+#include "ral_types.h"
+#include "ral_impl.h"
+
+CORE_DEFINE_HANDLE(buffer_handle);
+CORE_DEFINE_HANDLE(texture_handle);
+CORE_DEFINE_HANDLE(sampler_handle);
+CORE_DEFINE_HANDLE(shader_handle);
+CORE_DEFINE_HANDLE(pipeline_layout_handle);
+CORE_DEFINE_HANDLE(pipeline_handle);
+CORE_DEFINE_HANDLE(renderpass_handle);
+
+#define MAX_SHADER_DATA_LAYOUTS 8
+#define MAX_BUFFERS 256
+#define MAX_TEXTURES 256
+#define MAX_PIPELINES 128
+#define MAX_RENDERPASSES 128
+
+TYPED_POOL(gpu_buffer, buffer);
+TYPED_POOL(gpu_texture, texture);
+TYPED_POOL(gpu_pipeline_layout, pipeline_layout);
+TYPED_POOL(gpu_pipeline, pipeline);
+TYPED_POOL(gpu_renderpass, renderpass);
+
+// --- Handy macros
+#define BUFFER_GET(h) (buffer_pool_get(&context.resource_pools->buffers, h))
+#define TEXTURE_GET(h) (texture_pool_get(&context.resource_pools->textures, h))
+
+// --- Pools
+typedef struct gpu_backend_pools {
+ pipeline_pool pipelines;
+ pipeline_layout_pool pipeline_layouts;
+ renderpass_pool renderpasses;
+} gpu_backend_pools;
+void backend_pools_init(arena* a, gpu_backend_pools* backend_pools);
+
+struct resource_pools {
+ buffer_pool buffers;
+ texture_pool textures;
+};
+void resource_pools_init(arena* a, struct resource_pools* res_pools);
+
+// vertex_description static_3d_vertex_description(); \ No newline at end of file