diff options
Diffstat (limited to 'src/ral/ral_common.h')
-rw-r--r-- | src/ral/ral_common.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ral/ral_common.h b/src/ral/ral_common.h new file mode 100644 index 0000000..1088404 --- /dev/null +++ b/src/ral/ral_common.h @@ -0,0 +1,39 @@ +#pragma once +#include "defines.h" +#include "buf.h" +#include "mem.h" +#include "ral_types.h" +#include "ral_impl.h" + + +TYPED_POOL(GPU_Buffer, Buffer); +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_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 ResourcePools* res_pools); + + +// --- Vertex formats +bytebuffer vertices_as_bytebuffer(arena* a, VertexFormat format, Vertex_darray* vertices); + +void vertex_desc_add(VertexDescription* builder, const char* name, VertexAttribType type); +VertexDescription static_3d_vertex_description(); +size_t vertex_attrib_size(VertexAttribType attr); |