From 0c2f902238010903388b7d9a3af00979340eff2c Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Tue, 13 Aug 2024 13:18:24 +1000 Subject: add debug draw bbox and add topology to draw calls --- src/ral/backends/opengl/backend_opengl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/ral/backends/opengl/backend_opengl.c') diff --git a/src/ral/backends/opengl/backend_opengl.c b/src/ral/backends/opengl/backend_opengl.c index 3822220..613d7e1 100644 --- a/src/ral/backends/opengl/backend_opengl.c +++ b/src/ral/backends/opengl/backend_opengl.c @@ -411,11 +411,21 @@ void GPU_EncodeSetIndexBuffer(GPU_CmdEncoder* encoder, BufferHandle buf) { GPU_Buffer* buffer = BUFFER_GET(buf); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer->id.ibo); } -void GPU_EncodeDraw(GPU_CmdEncoder* encoder, u64 count) { glDrawArrays(GL_TRIANGLES, 0, count); } -void GPU_EncodeDrawIndexed(GPU_CmdEncoder* encoder, u64 index_count) { +void GPU_EncodeDrawTris(GPU_CmdEncoder* encoder, u64 count) { + glDrawArrays(GL_TRIANGLES, 0, count); +} +void GPU_EncodeDrawIndexedTris(GPU_CmdEncoder* encoder, u64 index_count) { glDrawElements(GL_TRIANGLES, index_count, GL_UNSIGNED_INT, 0); } +PUB void GPU_EncodeDraw(GPU_CmdEncoder* encoder, PrimitiveTopology topology, u64 count) { + glDrawArrays(opengl_prim_topology(topology), 0, count); +} +PUB void GPU_EncodeDrawIndexed(GPU_CmdEncoder* encoder, PrimitiveTopology topology, + u64 index_count) { + glDrawElements(opengl_prim_topology(topology), index_count, GL_UNSIGNED_INT, 0); +} + PUB void GPU_WriteTextureRegion(GPU_CmdEncoder* encoder, TextureHandle dst, u32 x_offset, u32 y_offset, u32 width, u32 height, const void* data) { CASSERT_MSG(data, "const void* data must not be NULL"); -- cgit v1.2.3-70-g09d2