summaryrefslogtreecommitdiff
path: root/src/ral/ral_impl.h
diff options
context:
space:
mode:
authoromnisci3nce <omniscient.oce@gmail.com>2024-07-14 21:47:25 +1000
committeromnisci3nce <omniscient.oce@gmail.com>2024-07-14 21:47:25 +1000
commit529a603128d5e9dc4701322f44961f165e2183e1 (patch)
tree3e5d65ac503b971412ae35bfc5fb67a438a3c364 /src/ral/ral_impl.h
parent5b001d39d42314085164724d3a417fb8ebd54f98 (diff)
generate api docs python
Diffstat (limited to 'src/ral/ral_impl.h')
-rw-r--r--src/ral/ral_impl.h56
1 files changed, 51 insertions, 5 deletions
diff --git a/src/ral/ral_impl.h b/src/ral/ral_impl.h
index 4d1c17a..a896eff 100644
--- a/src/ral/ral_impl.h
+++ b/src/ral/ral_impl.h
@@ -2,7 +2,9 @@
* @brief
*/
#pragma once
+#include "buf.h"
#include "defines.h"
+#include "ral_common.h"
#include "ral_types.h"
struct GLFWwindow;
@@ -18,7 +20,9 @@ typedef struct GPU_CmdBuffer GPU_CmdBuffer; // Ready for submission
typedef struct GPU_Buffer GPU_Buffer;
typedef struct GPU_Texture GPU_Texture;
-bool GPU_Backend_Init(const char* window_name, struct GLFWwindow* window);
+struct ResourcePools;
+
+bool GPU_Backend_Init(const char* window_name, struct GLFWwindow* window, struct ResourcePools* res_pools);
void GPU_Backend_Shutdown();
bool GPU_Device_Create(GPU_Device* out_device);
@@ -27,12 +31,54 @@ void GPU_Device_Destroy(GPU_Device* device);
bool GPU_Swapchain_Create(GPU_Swapchain* out_swapchain);
void GPU_Swapchain_Destroy(GPU_Swapchain* swapchain);
-GPU_Renderpass* GPU_Renderpass_Create(GPU_RenderpassDesc description);
-void GPU_Renderpass_Destroy(GPU_Renderpass* pass);
+PUB GPU_Renderpass* GPU_Renderpass_Create(GPU_RenderpassDesc description);
+PUB void GPU_Renderpass_Destroy(GPU_Renderpass* pass);
+
+PUB GPU_Pipeline* GPU_GraphicsPipeline_Create(GraphicsPipelineDesc description, GPU_Renderpass* renderpass);
+PUB void GraphicsPipeline_Destroy(GPU_Pipeline* pipeline);
+
+// --- Command buffer
+PUB GPU_CmdEncoder GPU_CmdEncoder_Create();
+PUB void GPU_CmdEncoder_Destroy(GPU_CmdEncoder* encoder);
+PUB void GPU_CmdEncoder_BeginRender(GPU_CmdEncoder* encoder, GPU_Renderpass* renderpass);
+PUB void GPU_CmdEncoder_EndRender(GPU_CmdEncoder* encoder);
+PUB GPU_CmdEncoder* GPU_GetDefaultEncoder();
+PUB void GPU_QueueSubmit(GPU_CmdBuffer* cmd_buffer);
+
+// --- Buffers
+PUB BufferHandle GPU_BufferCreate(u64 size, GPU_BufferType buf_type, GPU_BufferFlags flags, const void* data);
+PUB void GPU_BufferDestroy(BufferHandle handle);
+PUB void GPU_BufferUpload(BufferHandle buffer, size_t n_bytes, const void* data);
+
+// --- Textures
+PUB TextureHandle GPU_TextureCreate(TextureDesc desc, bool create_view, const void* data);
+PUB void GPU_TextureDestroy(TextureHandle handle);
+PUB void GPU_TextureUpload(TextureHandle handle, size_t n_bytes, const void* data);
+
+// --- Data copy commands
+// TODO: Rename these to reflect current coding style
+void encode_buffer_copy(GPU_CmdEncoder* encoder, BufferHandle src, u64 src_offset,
+ BufferHandle dst, u64 dst_offset, u64 copy_size);
+void buffer_upload_bytes(BufferHandle gpu_buf, bytebuffer cpu_buf, u64 offset, u64 size);
+
+void copy_buffer_to_buffer_oneshot(BufferHandle src, u64 src_offset, BufferHandle dst,
+ u64 dst_offset, u64 copy_size);
+void copy_buffer_to_image_oneshot(BufferHandle src, TextureHandle dst);
+
+// --- Render commands
+PUB void GPU_EncodeBindPipeline(GPU_CmdEncoder* encoder, GPU_Pipeline* pipeline);
+PUB void GPU_EncodeBindShaderData(GPU_CmdEncoder* encoder, u32 group, ShaderData* data);
+void GPU_EncodeSetDefaults(GPU_CmdEncoder* encoder);
+PUB void GPU_EncodeSetVertexBuffer(GPU_CmdEncoder* encoder, BufferHandle buf);
+PUB void GPU_EncodeSetIndexBuffer(GPU_CmdEncoder* encoder, BufferHandle buf);
+PUB void GPU_EncodeDraw(GPU_CmdEncoder* encoder, u64 count);
+PUB void GPU_EncodeDrawIndexed(GPU_CmdEncoder* encoder, u64 index_count);
-GPU_Pipeline* GPU_GraphicsPipeline_Create(GraphicsPipelineDesc description, GPU_Renderpass* renderpass);
-void GraphicsPipeline_Destroy(GPU_Pipeline* pipeline);
+// --- Frame cycle
+PUB bool GPU_Backend_BeginFrame();
+PUB void GPU_Backend_EndFrame();
+// Concrete implementation
#if defined(CEL_REND_BACKEND_OPENGL)
#include "backend_opengl.h"
#endif