ogl_beamforming

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

Commit: eaeb9dec4e7261362a57ff26faf1fa32ec332598
Parent: c2a462b584b7196540a5f709f3c62245f84b2459
Author: Randy Palamar
Date:   Tue, 26 Aug 2025 10:29:31 -0600

fix various issues with MSVC compilation, add note to README

One of the changed lines in build.c causes MSVC to fully crash.
Why do people care about this shitware?

Diffstat:
MREADME.md | 12++++++++++++
Mbeamformer.c | 4++--
Mbuild.c | 12+++++++-----
Mui.c | 4++--
4 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md @@ -27,3 +27,15 @@ development/debugging: Debug builds enable dynamic reloading of almost the entire program and you can make changes to most code and recompile without exiting the application. + +## MSVC Support + +MSVC is not the target compiler for this application. While some +attempt is made to keep an exe building with MSVC no effort is +spent testing that it works beyond launching and running. Some +previous attempts at testing it have indicated that MSVC is +miscompiling parts of the code. Additionally there have been valid +(as far as other C compilers are concerned) lines of code in this +project that have caused MSVC to **crash** during compilation. If +your compiler is so poorly written that it crashes on **ANY** +input is it really worth our effort to support? diff --git a/beamformer.c b/beamformer.c @@ -87,7 +87,7 @@ beamformer_compute_plan_for_block(BeamformerComputeContext *cc, u32 block, Arena GLenum gl_kind[] = {BEAMFORMER_COMPUTE_TEXTURE_LIST}; #undef X read_only local_persist s8 tex_prefix[] = { - #define X(k, ...) s8(#k "["), + #define X(k, ...) s8_comp(#k "["), BEAMFORMER_COMPUTE_TEXTURE_LIST #undef X }; @@ -109,7 +109,7 @@ function void beamformer_filter_update(BeamformerFilter *f, BeamformerFilterKind kind, BeamformerFilterParameters fp, u32 block, u32 slot, Arena arena) { - #define X(k, ...) s8(#k "Filter"), + #define X(k, ...) s8_comp(#k "Filter"), read_only local_persist s8 filter_kinds[] = {BEAMFORMER_FILTER_KIND_LIST(,)}; #undef X diff --git a/build.c b/build.c @@ -565,12 +565,15 @@ build_shared_library(Arena a, CommandList cc, char *name, char *output, char **l } function b32 -cc_single_file(Arena a, CommandList cc, b32 exe, char *src, char *dest, char **tail, iz tail_count) +cc_single_file(Arena a, CommandList cc, char *exe, char *src, char *dest, char **tail, iz tail_count) { char *executable[] = {src, is_msvc? "/Fe:" : "-o", dest}; char *object[] = {is_msvc? "/c" : "-c", src, is_msvc? "/Fo:" : "-o", dest}; + + cmd_append_count(&a, &cc, exe? executable : object, exe? countof(executable) : countof(object)); + if (exe) cmd_pdb(&a, &cc, exe); cmd_append_count(&a, &cc, tail, tail_count); cmd_append(&a, &cc, (void *)0); b32 result = run_synchronous(a, &cc); @@ -700,8 +703,7 @@ build_tests(Arena arena, CommandList cc) b32 result = 1; iz cc_count = cc.count; #define X(prog, ...) \ - cmd_pdb(&arena, &cc, prog); \ - result &= cc_single_file(arena, cc, 1, "tests/" prog ".c", \ + result &= cc_single_file(arena, cc, prog, "tests/" prog ".c", \ OUTPUT("tests/" prog), \ arg_list(char *, ##__VA_ARGS__)); \ cc.count = cc_count; @@ -830,7 +832,7 @@ build_matlab_bindings(Arena arena) Arena scratch = sub_arena(&arena, MB(1), 16); char *out = OUTPUT("matlab/OGLBeamformerLiveFeedbackFlags.m"); - if (needs_rebuild(out)) { + if (needs_rebuild(out, "beamformer_parameters.h")) { /* TODO(rnp): recreate/clear directory incase these file names change */ MetaprogramContext m = {.stream = arena_stream(arena)}; @@ -882,7 +884,7 @@ build_matlab_bindings(Arena arena) #undef X os_make_directory(OUTPUT("matlab/+OGLBeamformerFilter")); - #define X(kind, ...) {OUTPUT("matlab/+OGLBeamformerFilter/" #kind ".m"), s8(#kind), s8(#__VA_ARGS__)}, + #define X(kind, ...) {OUTPUT("matlab/+OGLBeamformerFilter/" #kind ".m"), s8_comp(#kind), s8_comp(#__VA_ARGS__)}, read_only local_persist struct {char *out; s8 class, args;} filter_table[] = { BEAMFORMER_FILTER_KIND_LIST(,) }; diff --git a/ui.c b/ui.c @@ -1258,7 +1258,7 @@ ui_beamformer_frame_view_convert(BeamformerUI *ui, Arena *arena, Variable *view, read_only local_persist s8 kind_labels[] = {BEAMFORMER_FRAME_VIEW_KIND_LIST}; #undef X bv->kind_cycler = add_variable_cycler(ui, menu, arena, V_EXTRA_ACTION, ui->small_font, - s8("Kind:"), &bv->kind, kind_labels, countof(kind_labels)); + s8("Kind:"), (u32 *)&bv->kind, kind_labels, countof(kind_labels)); switch (kind) { case BeamformerFrameViewKind_3DXPlane:{ @@ -1392,7 +1392,7 @@ add_compute_stats_view(BeamformerUI *ui, Variable *parent, Arena *arena, Beamfor ComputeStatsView *csv = &result->view.child->compute_stats_view; csv->compute_shader_stats = ctx->compute_shader_stats; csv->cycler = add_variable_cycler(ui, menu, arena, 0, ui->small_font, s8("Stats View:"), - &csv->kind, labels, countof(labels)); + (u32 *)&csv->kind, labels, countof(labels)); add_global_menu_to_group(ui, arena, menu); return result; }