diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-06-22 15:57:42 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-06-22 15:57:42 +1000 |
commit | 347b3020cdd121a90dd49164c5e8c0de99027624 (patch) | |
tree | a4bbc0b55f5bfe027632d8bb2ec80c6a5b003516 | |
parent | 51d0535a8d49b72ab1e47acf30f654403a94c423 (diff) |
check that we havent exceeded max uniform binding points
-rw-r--r-- | src/renderer/backends/opengl/backend_opengl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/renderer/backends/opengl/backend_opengl.c b/src/renderer/backends/opengl/backend_opengl.c index 0d69296..7d632c7 100644 --- a/src/renderer/backends/opengl/backend_opengl.c +++ b/src/renderer/backends/opengl/backend_opengl.c @@ -81,7 +81,7 @@ gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc descrip pipeline->vertex_desc = description.vertex_desc; // Allocate uniform buffers if needed - printf("data layouts %d\n", description.data_layouts_count); + // printf("data layouts %d\n", description.data_layouts_count); for (u32 layout_i = 0; layout_i < description.data_layouts_count; layout_i++) { shader_data_layout sdl = description.data_layouts[layout_i].shader_data_get_layout(NULL); TRACE("Got shader data layout %d's bindings! . found %d", layout_i, sdl.bindings_count); @@ -114,8 +114,8 @@ gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc descrip if (blockIndex != GL_INVALID_INDEX) { glUniformBlockBinding(pipeline->shader_id, blockIndex, s_binding_point); } - ubo_buf->ubo_binding_point = s_binding_point; - s_binding_point++; + ubo_buf->ubo_binding_point = s_binding_point++; + assert(s_binding_point < GL_MAX_UNIFORM_BUFFER_BINDINGS); } } } @@ -177,7 +177,9 @@ void gpu_cmd_encoder_begin_render(gpu_cmd_encoder* encoder, gpu_renderpass* rend glClearColor(clear_colour.r, clear_colour.g, clear_colour.b, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } -void gpu_cmd_encoder_end_render(gpu_cmd_encoder* encoder) {} +void gpu_cmd_encoder_end_render(gpu_cmd_encoder* encoder) { + glBindFramebuffer(GL_FRAMEBUFFER, 0); +} void gpu_cmd_encoder_begin_compute() {} gpu_cmd_encoder* gpu_get_default_cmd_encoder() { return &context.command_buffer; } |