ogl_beamforming

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

Commit: 30feed75fcb5eb06764b1db4f744d82a0bbf12c2
Parent: 707ae0d770af5edf7494feb5ec2f6e292d154eba
Author: Tyler Henry
Date:   Thu, 15 May 2025 10:03:25 -0600

cuda: integrate new function for setting the channel mapping

Diffstat:
Mbeamformer.c | 4++--
Mbeamformer.h | 15++++++++++-----
2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/beamformer.c b/beamformer.c @@ -138,8 +138,7 @@ alloc_shader_storage(BeamformerCtx *ctx, u32 rf_raw_size, Arena a) /* NOTE(rnp): these are stubs when CUDA isn't supported */ ctx->cuda_lib.register_cuda_buffers(cs->rf_data_ssbos, ARRAY_COUNT(cs->rf_data_ssbos), cs->raw_data_ssbo); - ctx->cuda_lib.init_cuda_configuration(bp->rf_raw_dim, bp->dec_data_dim, - ctx->shared_memory->channel_mapping); + ctx->cuda_lib.init_cuda_configuration(bp->rf_raw_dim, bp->dec_data_dim); u32 order = cs->dec_data_dim.z; i32 *hadamard = make_hadamard_transpose(&a, order); @@ -517,6 +516,7 @@ complete_queue(BeamformerCtx *ctx, BeamformWorkQueue *q, Arena arena, iptr gl_co tex_type = GL_SHORT; tex_format = GL_RED_INTEGER; tex_element_count = ARRAY_COUNT(sm->channel_mapping); + ctx->cuda_lib.cuda_set_channel_mapping(sm->channel_mapping); } break; case BU_KIND_FOCAL_VECTORS: { tex_1d = cs->focal_vectors_texture; diff --git a/beamformer.h b/beamformer.h @@ -24,7 +24,7 @@ typedef struct { b32 executable_reloaded; } BeamformerInput; -#define INIT_CUDA_CONFIGURATION_FN(name) void name(u32 *input_dims, u32 *decoded_dims, i16 *channel_mapping) +#define INIT_CUDA_CONFIGURATION_FN(name) void name(u32 *input_dims, u32 *decoded_dims) typedef INIT_CUDA_CONFIGURATION_FN(init_cuda_configuration_fn); INIT_CUDA_CONFIGURATION_FN(init_cuda_configuration_stub) {} @@ -40,10 +40,15 @@ CUDA_DECODE_FN(cuda_decode_stub) {} typedef CUDA_HILBERT_FN(cuda_hilbert_fn); CUDA_HILBERT_FN(cuda_hilbert_stub) {} -#define CUDA_LIB_FNS \ - X(cuda_decode) \ - X(cuda_hilbert) \ - X(init_cuda_configuration) \ +#define CUDA_SET_CHANNEL_MAPPING_FN(name) void name(i16 *channel_mapping) +typedef CUDA_SET_CHANNEL_MAPPING_FN(cuda_set_channel_mapping_fn); +CUDA_SET_CHANNEL_MAPPING_FN(cuda_set_channel_mapping_stub) {} + +#define CUDA_LIB_FNS \ + X(cuda_decode) \ + X(cuda_hilbert) \ + X(cuda_set_channel_mapping) \ + X(init_cuda_configuration) \ X(register_cuda_buffers) typedef struct {