ogl_beamforming

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

Commit: 3c7e395f1cd52035115a6cda9a2841b12e01a55e
Parent: eb7994cd9cce632a6790824f2438aa44926100ef
Author: Randy Palamar
Date:   Mon, 16 Mar 2026 06:02:40 -0600

core: complete_queue: cleanup old commit tracking

This hasn't been used in a while. Improve clarity by updating in a
single place.

Diffstat:
Mbeamformer_core.c | 24+++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/beamformer_core.c b/beamformer_core.c @@ -1020,9 +1020,10 @@ complete_queue(BeamformerCtx *ctx, BeamformWorkQueue *q, Arena *arena) BeamformerComputeContext * cs = &ctx->compute_context; BeamformerSharedMemory * sm = ctx->shared_memory; - BeamformWork *work = beamform_work_queue_pop(q); - while (work) { - b32 can_commit = 1; + for (BeamformWork *work = beamform_work_queue_pop(q); + work; + beamform_work_queue_pop_commit(q), work = beamform_work_queue_pop(q)) + { switch (work->kind) { case BeamformerWorkKind_ExportBuffer:{ @@ -1083,12 +1084,14 @@ complete_queue(BeamformerCtx *ctx, BeamformWorkQueue *q, Arena *arena) post_sync_barrier(ctx->shared_memory, BeamformerSharedMemoryLockKind_DispatchCompute); u32 dirty_programs = atomic_swap_u32(&cp->dirty_programs, 0); - static_assert(ISPOWEROF2(BeamformerMaxComputeShaderStages), - "max compute shader stages must be power of 2"); + static_assert(IsPowerOfTwo(BeamformerMaxComputeShaderStages), ""); assert((dirty_programs & ~((u32)BeamformerMaxComputeShaderStages - 1)) == 0); - for EachBit(dirty_programs, slot) { - beamformer_reload_compute_pipeline(cp->vulkan_pipelines + slot, cp->pipeline.shaders[slot], - cp->shader_descriptors + slot, *arena); + if unlikely(dirty_programs) { + for EachBit(dirty_programs, slot) { + beamformer_reload_compute_pipeline(cp->vulkan_pipelines + slot, + cp->pipeline.shaders[slot], + cp->shader_descriptors + slot, *arena); + } } atomic_store_u32(&cs->processing_compute, 1); @@ -1238,11 +1241,6 @@ complete_queue(BeamformerCtx *ctx, BeamformWorkQueue *q, Arena *arena) }break; InvalidDefaultCase; } - - if (can_commit) { - beamform_work_queue_pop_commit(q); - work = beamform_work_queue_pop(q); - } } }