summaryrefslogtreecommitdiff
path: root/src/ral/backends
diff options
context:
space:
mode:
authoromnisci3nce <omniscient.oce@gmail.com>2024-07-17 23:12:42 +1000
committeromnisci3nce <omniscient.oce@gmail.com>2024-07-17 23:12:42 +1000
commitc3737fff1be704e14a2bada69bbf8a6709c5f670 (patch)
treeaa2225901f26598b07855a65a944354fbedc40b1 /src/ral/backends
parentf8641a5cc4c8baf1f0a7be3685afc219d90143d9 (diff)
wip shader layouts for common stuff
Diffstat (limited to 'src/ral/backends')
-rw-r--r--src/ral/backends/opengl/backend_opengl.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ral/backends/opengl/backend_opengl.c b/src/ral/backends/opengl/backend_opengl.c
index cbfd855..ecf0e80 100644
--- a/src/ral/backends/opengl/backend_opengl.c
+++ b/src/ral/backends/opengl/backend_opengl.c
@@ -174,7 +174,7 @@ BufferHandle GPU_BufferCreate(u64 size, GPU_BufferType buf_type, GPU_BufferFlags
const void* data) {
// "allocating" the cpu-side buffer struct
BufferHandle handle;
- GPU_Buffer* buffer = Buffer_pool_alloc(&context.resource_pools, &handle);
+ GPU_Buffer* buffer = Buffer_pool_alloc(&context.resource_pools->buffers, &handle);
buffer->size = size;
buffer->vao = 0;
@@ -269,6 +269,22 @@ TextureHandle GPU_TextureCreate(TextureDesc desc, bool create_view, const void*
return handle;
}
+GPU_Texture* GPU_TextureAlloc(TextureHandle* out_handle) {
+ TextureHandle handle;
+ GPU_Texture* texture = Texture_pool_alloc(&context.resource_pools->textures, &handle);
+ DEBUG("Allocated texture with handle %d", handle.raw);
+
+ GLuint gl_texture_id;
+ glGenTextures(1, &gl_texture_id);
+ texture->id = gl_texture_id;
+
+ if (out_handle != NULL) {
+ *out_handle = handle;
+ }
+
+ return texture;
+}
+
void GPU_TextureDestroy(TextureHandle handle) { glDeleteTextures(1, &handle.raw); }
// TODO: void GPU_TextureUpload(TextureHandle handle, size_t n_bytes, const void* data)