summaryrefslogtreecommitdiff
path: root/src/ral/ral_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ral/ral_common.h')
-rw-r--r--src/ral/ral_common.h53
1 files changed, 23 insertions, 30 deletions
diff --git a/src/ral/ral_common.h b/src/ral/ral_common.h
index fabf264..1088404 100644
--- a/src/ral/ral_common.h
+++ b/src/ral/ral_common.h
@@ -1,46 +1,39 @@
#pragma once
#include "defines.h"
+#include "buf.h"
#include "mem.h"
#include "ral_types.h"
#include "ral_impl.h"
-CORE_DEFINE_HANDLE(BufferHandle);
-CORE_DEFINE_HANDLE(TextureHandle);
-CORE_DEFINE_HANDLE(SamplerHandle);
-CORE_DEFINE_HANDLE(ShaderHandle);
-
-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);
+TYPED_POOL(GPU_Texture, Texture);
+TYPED_POOL(GPU_PipelineLayout, PipelineLayout);
+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;
+typedef struct GPU_BackendPools{
+ Pipeline_pool pipelines;
+ PipelineLayout_pool pipeline_layouts;
+ Renderpass_pool renderpasses;
+} GPU_BackendPools;
+void backend_pools_init(arena* a, GPU_BackendPools* backend_pools);
+
+struct ResourcePools {
+ Buffer_pool buffers;
+ Texture_pool textures;
};
-void resource_pools_init(arena* a, struct resource_pools* res_pools);
+void resource_pools_init(arena* a, struct ResourcePools* res_pools);
+
+
+// --- Vertex formats
+bytebuffer vertices_as_bytebuffer(arena* a, VertexFormat format, Vertex_darray* vertices);
-// vertex_description static_3d_vertex_description();
+void vertex_desc_add(VertexDescription* builder, const char* name, VertexAttribType type);
+VertexDescription static_3d_vertex_description();
+size_t vertex_attrib_size(VertexAttribType attr);