Commit: ef0092f61ffafc53bc8a7df37369314104d6ab46
Parent: b4e0ee91ef624a6f186f7cd460ff7aabfd7774f3
Author: Randy Palamar
Date: Wed, 14 Aug 2024 22:43:34 -0600
drop commented out code for separate lpf coefficient buffer
I don't see a good reason for this to not just remain part of the UBO.
Diffstat:
4 files changed, 2 insertions(+), 37 deletions(-)
diff --git a/beamformer.c b/beamformer.c
@@ -33,25 +33,6 @@ alloc_output_image(BeamformerCtx *ctx)
}
static void
-upload_filter_coefficients(BeamformerCtx *ctx, Arena a)
-{
- ctx->flags &= ~UPLOAD_FILTER;
- return;
-#if 0
- f32 lpf_coeff[] = {
- 0.001504252781, 0.006636276841, 0.01834679954, 0.0386288017,
- 0.06680636108, 0.09852545708, 0.1264867932, 0.1429549307,
- 0.1429549307, 0.1264867932, 0.09852545708, 0.06680636108,
- 0.0386288017, 0.01834679954, 0.006636276841, 0.001504252781,
- };
- u32 lpf_coeff_count = ARRAY_COUNT(lpf_coeff);
- ctx->csctx.lpf_order = lpf_coeff_count - 1;
- rlUnloadShaderBuffer(ctx->csctx.lpf_ssbo);
- ctx->csctx.lpf_ssbo = rlLoadShaderBuffer(lpf_coeff_count * sizeof(f32), lpf_coeff, GL_STATIC_DRAW);
-#endif
-}
-
-static void
alloc_shader_storage(BeamformerCtx *ctx, Arena a)
{
ComputeShaderCtx *cs = &ctx->csctx;
@@ -589,9 +570,6 @@ do_beamformer(BeamformerCtx *ctx, Arena arena)
else ctx->partial_transfer_count++;
}
- if (ctx->flags & UPLOAD_FILTER)
- upload_filter_coefficients(ctx, arena);
-
if (ctx->flags & DO_COMPUTE) {
if (ctx->params->upload) {
glNamedBufferSubData(ctx->csctx.shared_ubo, 0, sizeof(*bp), bp);
diff --git a/beamformer.h b/beamformer.h
@@ -42,7 +42,6 @@ typedef union {
} Rect;
enum compute_shaders {
-// CS_FORCES,
CS_HADAMARD,
// CS_HERCULES,
CS_LPF,
@@ -55,7 +54,6 @@ enum program_flags {
RELOAD_SHADERS = 1 << 0,
ALLOC_SSBOS = 1 << 1,
ALLOC_OUT_TEX = 1 << 2,
- UPLOAD_FILTER = 1 << 3,
GEN_MIPMAPS = 1 << 29,
DO_COMPUTE = 1 << 30,
};
@@ -107,7 +105,7 @@ typedef struct {
/* NOTE: the raw_data_ssbo is allocated at 3x the required size to allow for tiled
* transfers when the GPU is running behind the CPU. It is not mapped on NVIDIA because
* their drivers _will_ store the buffer in the system memory. This doesn't happen
- * for Intel or AMD and mapping the buffer is prefered. In either case incoming data can
+ * for Intel or AMD and mapping the buffer is preferred. In either case incoming data can
* be written to the arena at the appropriate offset for the current raw_data_index. An
* additional BufferSubData is needed on NVIDIA to upload the data. */
GLsync raw_data_fences[3];
@@ -129,10 +127,6 @@ typedef struct {
i32 out_data_tex_id;
i32 mip_view_tex_id;
i32 mips_level_id;
-
- //u32 lpf_ssbo;
- //u32 lpf_order;
- //i32 lpf_order_id;
} ComputeShaderCtx;
typedef struct {
diff --git a/main.c b/main.c
@@ -139,7 +139,6 @@ reload_shaders(BeamformerCtx *ctx, Arena a)
glDeleteShader(shader_id);
}
- //csctx->lpf_order_id = glGetUniformLocation(csctx->programs[CS_LPF], "u_lpf_order");
csctx->out_data_tex_id = glGetUniformLocation(csctx->programs[CS_UFORCES], "u_out_data_tex");
csctx->mip_view_tex_id = glGetUniformLocation(csctx->programs[CS_MIN_MAX], "u_mip_view_tex");
csctx->mips_level_id = glGetUniformLocation(csctx->programs[CS_MIN_MAX], "u_mip_map");
@@ -214,7 +213,7 @@ main(void)
reload_shaders(&ctx, temp_memory);
ctx.flags &= ~DO_COMPUTE;
- ctx.flags |= ALLOC_SSBOS|ALLOC_OUT_TEX|UPLOAD_FILTER;
+ ctx.flags |= ALLOC_SSBOS|ALLOC_OUT_TEX;
while(!WindowShouldClose()) {
do_debug();
diff --git a/shaders/lpf.glsl b/shaders/lpf.glsl
@@ -10,10 +10,6 @@ layout(std430, binding = 2) writeonly restrict buffer buffer_2 {
vec2 out_data[];
};
-//layout(std430, binding = 3) readonly restrict buffer buffer_3 {
-// float lpf_coeff[];
-//};
-
layout(std140, binding = 0) uniform parameters {
uvec4 channel_mapping[64]; /* Transducer Channel to Verasonics Channel */
uvec4 uforces_channels[32]; /* Channels used for virtual UFORCES elements */
@@ -35,8 +31,6 @@ layout(std140, binding = 0) uniform parameters {
uint uforces; /* mode is UFORCES (1) or FORCES (0) */
};
-//layout(location = 1) uniform uint u_lpf_order;
-
void main()
{
uint time_sample = gl_GlobalInvocationID.x;