Commit: 35680fa6add8c25f0f88c20cc0a9f2d69ed84033
Parent: 1545fc74e9b5d723d8087d76f48d93a8f4bf7f96
Author: Randy Palamar
Date: Mon, 24 Feb 2025 19:14:31 -0700
das: cycle_t increment once per frame
This is strictly more useful for the debugging we do in das than a float.
Diffstat:
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/beamformer.c b/beamformer.c
@@ -2,7 +2,7 @@
#include "beamformer.h"
static f32 dt_for_frame;
-static f32 cycle_t;
+static u32 cycle_t;
static size
decoded_data_size(ComputeShaderCtx *cs)
@@ -551,9 +551,6 @@ DEBUG_EXPORT BEAMFORMER_COMPLETE_COMPUTE_FN(beamformer_complete_compute)
BeamformerParameters *bp = &ctx->params->raw;
- if (ctx->csctx.programs[CS_DAS])
- glProgramUniform1f(ctx->csctx.programs[CS_DAS], ctx->csctx.cycle_t_id, cycle_t);
-
while (work) {
switch (work->type) {
case BW_RELOAD_SHADER: {
@@ -629,6 +626,9 @@ DEBUG_EXPORT BEAMFORMER_COMPLETE_COMPUTE_FN(beamformer_complete_compute)
ctx->params->upload = 0;
}
+ if (cs->programs[CS_DAS])
+ glProgramUniform1ui(cs->programs[CS_DAS], cs->cycle_t_id, cycle_t++);
+
uv3 try_dim = ctx->params->raw.output_points.xyz;
if (!uv3_equal(try_dim, frame->dim)) {
size frame_index = frame - ctx->beamform_frames;
@@ -681,9 +681,6 @@ DEBUG_EXPORT BEAMFORMER_FRAME_STEP_FN(beamformer_frame_step)
{
dt_for_frame = GetFrameTime();
- cycle_t += dt_for_frame;
- if (cycle_t > 1) cycle_t -= 1;
-
if (IsWindowResized()) {
ctx->window_size.h = GetScreenHeight();
ctx->window_size.w = GetScreenWidth();
diff --git a/shaders/das.glsl b/shaders/das.glsl
@@ -8,7 +8,7 @@ layout(std430, binding = 1) readonly restrict buffer buffer_1 {
layout(rg32f, binding = 0) writeonly uniform image3D u_out_data_tex;
layout(location = 2) uniform ivec3 u_voxel_offset;
-layout(location = 3) uniform float u_cycle_t;
+layout(location = 3) uniform uint u_cycle_t;
#define C_SPLINE 0.5