ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | LICENSE

Commit: 27acc14d5d7b249501eb686a9aca46bac4af6bab
Parent: 7dc44c6bf83ccb4300943ca37855ec331a57fae6
Author: Randy Palamar
Date:   Tue, 12 Nov 2024 21:16:03 -0700

remove unnecessary ubo binding

This only needs to happen when the program is loaded.

Diffstat:
Mbeamformer.c | 3---
Mstatic.c | 2++
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/beamformer.c b/beamformer.c @@ -333,7 +333,6 @@ do_partial_compute_step(BeamformerCtx *ctx, BeamformFrame *frame) cs->timer_active[cs->timer_index][pc->shader] = 1; glUseProgram(cs->programs[pc->shader]); - glBindBufferBase(GL_UNIFORM_BUFFER, 0, cs->shared_ubo); /* NOTE: We must tile this otherwise GL will kill us for taking too long */ /* TODO: this could be based on multiple dimensions */ @@ -366,7 +365,6 @@ do_compute_shader(BeamformerCtx *ctx, BeamformFrame *frame, u32 raw_data_index, csctx->timer_active[csctx->timer_index][shader] = 1; glUseProgram(csctx->programs[shader]); - glBindBufferBase(GL_UNIFORM_BUFFER, 0, csctx->shared_ubo); u32 output_ssbo_idx = !csctx->last_output_ssbo_index; u32 input_ssbo_idx = csctx->last_output_ssbo_index; @@ -422,7 +420,6 @@ do_compute_shader(BeamformerCtx *ctx, BeamformFrame *frame, u32 raw_data_index, do_beamform_shader(csctx, &ctx->params->raw, frame, rf_ssbo, dispatch_dim, (iv3){0}, 0); if (frame->dim.w > 1) { glUseProgram(csctx->programs[CS_SUM]); - glBindBufferBase(GL_UNIFORM_BUFFER, 0, csctx->shared_ubo); u32 input_texture_count = frame->dim.w - 1; do_sum_shader(csctx, frame->textures, input_texture_count, 1 / (f32)input_texture_count, frame->textures[frame->dim.w - 1], diff --git a/static.c b/static.c @@ -204,6 +204,8 @@ reload_shaders(BeamformerCtx *ctx, Arena a) if (shader_id) { glDeleteProgram(csctx->programs[i]); csctx->programs[i] = rlLoadComputeShaderProgram(shader_id); + glUseProgram(csctx->programs[csctx->programs[i]]); + glBindBufferBase(GL_UNIFORM_BUFFER, 0, csctx->shared_ubo); LABEL_GL_OBJECT(GL_PROGRAM, csctx->programs[i], compute_shaders[i].label); }