ogl_beamforming

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

beamformer.meta.c (28909B)


      1 /* See LICENSE for license details. */
      2 
      3 // GENERATED CODE
      4 
      5 // NOTE: Constants (Integer)
      6 #define BeamformerChunkChannelCount        (16)
      7 #define BeamformerFilterSlots              (4)
      8 #define BeamformerMaxBacklogFrames         (4096)
      9 #define BeamformerMaxChannelCount          (256)
     10 #define BeamformerMaxEmissionsCount        (256)
     11 #define BeamformerMaxComputeShaderStages   (16)
     12 #define BeamformerMaxParameterBlocks       (16)
     13 #define BeamformerMaxRawDataFramesInFlight (3)
     14 
     15 // NOTE: Constants (Float)
     16 
     17 typedef enum {
     18 	BeamformerShaderResourceKind_Buffer = 0,
     19 	BeamformerShaderResourceKind_Count,
     20 } BeamformerShaderResourceKind;
     21 
     22 typedef enum {
     23 	BeamformerShaderBufferSlot_BeamformedData = 0,
     24 	BeamformerShaderBufferSlot_PingPong       = 1,
     25 	BeamformerShaderBufferSlot_Count,
     26 } BeamformerShaderBufferSlot;
     27 
     28 typedef enum {
     29 	BeamformerDecodeMode_None     = 0,
     30 	BeamformerDecodeMode_Hadamard = 1,
     31 	BeamformerDecodeMode_Count,
     32 } BeamformerDecodeMode;
     33 
     34 typedef enum {
     35 	BeamformerRCAOrientation_None    = 0,
     36 	BeamformerRCAOrientation_Rows    = 1,
     37 	BeamformerRCAOrientation_Columns = 2,
     38 	BeamformerRCAOrientation_Count,
     39 } BeamformerRCAOrientation;
     40 
     41 typedef enum {
     42 	BeamformerSamplingMode_2X = 0,
     43 	BeamformerSamplingMode_4X = 1,
     44 	BeamformerSamplingMode_Count,
     45 } BeamformerSamplingMode;
     46 
     47 typedef enum {
     48 	BeamformerDataKind_Int16          = 0,
     49 	BeamformerDataKind_Int16Complex   = 1,
     50 	BeamformerDataKind_Float32        = 2,
     51 	BeamformerDataKind_Float32Complex = 3,
     52 	BeamformerDataKind_Float16        = 4,
     53 	BeamformerDataKind_Float16Complex = 5,
     54 	BeamformerDataKind_Count,
     55 } BeamformerDataKind;
     56 
     57 typedef enum {
     58 	BeamformerContrastMode_None = 0,
     59 	BeamformerContrastMode_A1S2 = 1,
     60 	BeamformerContrastMode_Count,
     61 } BeamformerContrastMode;
     62 
     63 typedef enum {
     64 	BeamformerEmissionKind_Sine  = 0,
     65 	BeamformerEmissionKind_Chirp = 1,
     66 	BeamformerEmissionKind_Count,
     67 } BeamformerEmissionKind;
     68 
     69 typedef enum {
     70 	BeamformerInterpolationMode_Nearest = 0,
     71 	BeamformerInterpolationMode_Linear  = 1,
     72 	BeamformerInterpolationMode_Cubic   = 2,
     73 	BeamformerInterpolationMode_Count,
     74 } BeamformerInterpolationMode;
     75 
     76 typedef enum {
     77 	BeamformerViewPlaneTag_XZ        = 0,
     78 	BeamformerViewPlaneTag_YZ        = 1,
     79 	BeamformerViewPlaneTag_XY        = 2,
     80 	BeamformerViewPlaneTag_Arbitrary = 3,
     81 	BeamformerViewPlaneTag_Count,
     82 } BeamformerViewPlaneTag;
     83 
     84 typedef enum {
     85 	BeamformerAcquisitionKind_FORCES         = 0,
     86 	BeamformerAcquisitionKind_UFORCES        = 1,
     87 	BeamformerAcquisitionKind_HERCULES       = 2,
     88 	BeamformerAcquisitionKind_RCA_VLS        = 3,
     89 	BeamformerAcquisitionKind_RCA_TPW        = 4,
     90 	BeamformerAcquisitionKind_UHERCULES      = 5,
     91 	BeamformerAcquisitionKind_RACES          = 6,
     92 	BeamformerAcquisitionKind_EPIC_FORCES    = 7,
     93 	BeamformerAcquisitionKind_EPIC_UFORCES   = 8,
     94 	BeamformerAcquisitionKind_EPIC_UHERCULES = 9,
     95 	BeamformerAcquisitionKind_Flash          = 10,
     96 	BeamformerAcquisitionKind_HERO_PA        = 11,
     97 	BeamformerAcquisitionKind_ULM            = 12,
     98 	BeamformerAcquisitionKind_Count,
     99 } BeamformerAcquisitionKind;
    100 
    101 typedef enum {
    102 	BeamformerFilterKind_Kaiser       = 0,
    103 	BeamformerFilterKind_MatchedChirp = 1,
    104 	BeamformerFilterKind_Count,
    105 } BeamformerFilterKind;
    106 
    107 typedef enum {
    108 	BeamformerLiveFeedbackFlags_ImagePlaneOffsets = 0,
    109 	BeamformerLiveFeedbackFlags_TransmitPower     = 1,
    110 	BeamformerLiveFeedbackFlags_TGCControlPoints  = 2,
    111 	BeamformerLiveFeedbackFlags_SaveData          = 3,
    112 	BeamformerLiveFeedbackFlags_SaveNameTag       = 4,
    113 	BeamformerLiveFeedbackFlags_StopImaging       = 5,
    114 	BeamformerLiveFeedbackFlags_AcquisitionKind   = 6,
    115 	BeamformerLiveFeedbackFlags_Count,
    116 } BeamformerLiveFeedbackFlags;
    117 
    118 typedef enum {
    119 	BeamformerPanelKind_Nil                 = 0,
    120 	BeamformerPanelKind_Split               = 1,
    121 	BeamformerPanelKind_TabGroup            = 2,
    122 	BeamformerPanelKind_ComputeBarGraph     = 3,
    123 	BeamformerPanelKind_ComputeStats        = 4,
    124 	BeamformerPanelKind_FrameViewLive       = 5,
    125 	BeamformerPanelKind_FrameViewCopy       = 6,
    126 	BeamformerPanelKind_FrameViewXPlane     = 7,
    127 	BeamformerPanelKind_LiveImagingControls = 8,
    128 	BeamformerPanelKind_ParameterListing    = 9,
    129 	BeamformerPanelKind_Count,
    130 } BeamformerPanelKind;
    131 
    132 typedef enum {
    133 	BeamformerRegisterSlot_String         = 0,
    134 	BeamformerRegisterSlot_TreeNode       = 1,
    135 	BeamformerRegisterSlot_Window         = 2,
    136 	BeamformerRegisterSlot_Frame          = 3,
    137 	BeamformerRegisterSlot_FrameView      = 4,
    138 	BeamformerRegisterSlot_SplitAxis      = 5,
    139 	BeamformerRegisterSlot_SplitLeftTree  = 6,
    140 	BeamformerRegisterSlot_SplitRightTree = 7,
    141 	BeamformerRegisterSlot_DropTargetTree = 8,
    142 	BeamformerRegisterSlot_DropChildIndex = 9,
    143 	BeamformerRegisterSlot_Count,
    144 } BeamformerRegisterSlot;
    145 
    146 typedef enum {
    147 	BeamformerCommandKind_Nil       = 0,
    148 	BeamformerCommandKind_CloseTab  = 1,
    149 	BeamformerCommandKind_FocusTab  = 2,
    150 	BeamformerCommandKind_MoveTab   = 3,
    151 	BeamformerCommandKind_OpenTab   = 4,
    152 	BeamformerCommandKind_SplitTree = 5,
    153 	BeamformerCommandKind_Count,
    154 } BeamformerCommandKind;
    155 
    156 typedef enum {
    157 	BeamformerLiveImagingDirtyFlags_ImagePlaneOffsets = 1 << 0,
    158 	BeamformerLiveImagingDirtyFlags_TransmitPower     = 1 << 1,
    159 	BeamformerLiveImagingDirtyFlags_TGCControlPoints  = 1 << 2,
    160 	BeamformerLiveImagingDirtyFlags_SaveData          = 1 << 3,
    161 	BeamformerLiveImagingDirtyFlags_SaveNameTag       = 1 << 4,
    162 	BeamformerLiveImagingDirtyFlags_StopImaging       = 1 << 5,
    163 	BeamformerLiveImagingDirtyFlags_AcquisitionKind   = 1 << 6,
    164 } BeamformerLiveImagingDirtyFlags;
    165 
    166 typedef enum {
    167 	BeamformerPanelFlags_List        = 1 << 0,
    168 	BeamformerPanelFlags_NeedsFrame  = 1 << 1,
    169 	BeamformerPanelFlags_HasSettings = 1 << 2,
    170 } BeamformerPanelFlags;
    171 
    172 typedef enum {
    173 	BeamformerShaderKind_Decode             = 0,
    174 	BeamformerShaderKind_Filter             = 1,
    175 	BeamformerShaderKind_Demodulate         = 2,
    176 	BeamformerShaderKind_DAS                = 3,
    177 	BeamformerShaderKind_Sum                = 4,
    178 	BeamformerShaderKind_MinMax             = 5,
    179 	BeamformerShaderKind_Hilbert            = 6,
    180 	BeamformerShaderKind_CoherencyWeighting = 7,
    181 	BeamformerShaderKind_Reshape            = 8,
    182 	BeamformerShaderKind_RenderBeamformed   = 9,
    183 	BeamformerShaderKind_Count,
    184 
    185 	BeamformerShaderKind_ComputeFirst        = BeamformerShaderKind_Decode,
    186 	BeamformerShaderKind_ComputeLast         = BeamformerShaderKind_Hilbert,
    187 	BeamformerShaderKind_ComputeCount        = 7,
    188 	BeamformerShaderKind_ComputeHelpersFirst = BeamformerShaderKind_CoherencyWeighting,
    189 	BeamformerShaderKind_ComputeHelpersLast  = BeamformerShaderKind_Reshape,
    190 	BeamformerShaderKind_ComputeHelpersCount = 2,
    191 	BeamformerShaderKind_RenderFirst         = BeamformerShaderKind_RenderBeamformed,
    192 	BeamformerShaderKind_RenderLast          = BeamformerShaderKind_RenderBeamformed,
    193 	BeamformerShaderKind_RenderCount         = 1,
    194 } BeamformerShaderKind;
    195 
    196 typedef struct {
    197 	b32 use_shared_memory;
    198 	u32 decode_mode;
    199 	u32 output_channel_stride;
    200 	u32 output_sample_stride;
    201 	u32 output_transmit_stride;
    202 	u32 to_process;
    203 	u32 transmit_count;
    204 	u32 chunk_channel_count;
    205 	b32 cooperative_matrix;
    206 	u32 cooperative_matrix_m;
    207 	u32 cooperative_matrix_n;
    208 	u32 cooperative_matrix_k;
    209 } BeamformerDecodeBakeParameters;
    210 
    211 typedef struct {
    212 	u32 demodulate;
    213 	u32 complex_filter;
    214 	u32 decimation_rate;
    215 	u32 filter_length;
    216 	u32 input_channel_stride;
    217 	u32 input_sample_stride;
    218 	u32 input_transmit_stride;
    219 	u32 output_channel_stride;
    220 	u32 output_sample_stride;
    221 	u32 output_transmit_stride;
    222 	u32 sample_count;
    223 	u32 batch_sample_count;
    224 	f32 demodulation_frequency;
    225 	f32 sampling_frequency;
    226 } BeamformerFilterBakeParameters;
    227 
    228 typedef struct {
    229 	u32 coherency_weighting;
    230 	u32 single_focus;
    231 	u32 single_orientation;
    232 	u32 sparse;
    233 	u32 acquisition_count;
    234 	u32 acquisition_kind;
    235 	u32 channel_count;
    236 	u32 chunk_channel_count;
    237 	u32 interpolation_mode;
    238 	u32 sample_count;
    239 	u32 transmit_receive_orientation;
    240 	f32 demodulation_frequency;
    241 	f32 f_number;
    242 	f32 focus_depth;
    243 	f32 sampling_frequency;
    244 	f32 speed_of_sound;
    245 	f32 time_offset;
    246 	f32 transmit_angle;
    247 } BeamformerDASBakeParameters;
    248 
    249 typedef struct {
    250 	u32 size_x;
    251 	u32 size_y;
    252 	u32 size_z;
    253 	u32 input_stride_x;
    254 	u32 input_stride_y;
    255 	u32 input_stride_z;
    256 	u32 output_stride_x;
    257 	u32 output_stride_y;
    258 	u32 output_stride_z;
    259 	b32 interleave;
    260 	b32 deinterleave;
    261 } BeamformerReshapeBakeParameters;
    262 
    263 typedef struct {
    264 	u64 hadamard_buffer;
    265 	u64 rf_buffer;
    266 	u64 output_buffer;
    267 } BeamformerDecodePushConstants;
    268 
    269 typedef struct {
    270 	u64 input_data;
    271 	u64 filter_coefficients;
    272 	u32 output_element_offset;
    273 } BeamformerFilterPushConstants;
    274 
    275 typedef struct {
    276 	m4  xdc_transform;
    277 	m4  voxel_transform;
    278 	v2  xdc_element_pitch;
    279 	u64 array_parameters;
    280 	u64 output_frame;
    281 	u64 incoherent_frame;
    282 	u32 rf_element_offset;
    283 	u32 output_size_x;
    284 	u32 output_size_y;
    285 	u32 output_size_z;
    286 	u32 cycle_t;
    287 	i32 channel_offset;
    288 } BeamformerDASPushConstants;
    289 
    290 typedef struct {
    291 	u64 output_data;
    292 	u64 input_data;
    293 	u32 image_elements;
    294 	f32 scale;
    295 } BeamformerSumPushConstants;
    296 
    297 typedef struct {
    298 	u64 left_side_buffer;
    299 	u64 right_side_buffer;
    300 	f32 scale;
    301 	u32 output_size_x;
    302 	u32 output_size_y;
    303 	u32 output_size_z;
    304 } BeamformerCoherencyWeightingPushConstants;
    305 
    306 typedef struct {
    307 	u64 output_buffer;
    308 	u64 left_input_buffer;
    309 	u64 right_input_buffer;
    310 } BeamformerReshapePushConstants;
    311 
    312 typedef struct {
    313 	m4  mvp_matrix;
    314 	u64 positions;
    315 	u64 normals;
    316 	v4  bounding_box_colour;
    317 	f32 bounding_box_fraction;
    318 	f32 db_cutoff;
    319 	f32 threshold;
    320 	f32 gamma;
    321 	u64 input_data;
    322 	u32 input_size_x;
    323 	u32 input_size_y;
    324 	u32 input_size_z;
    325 	u32 data_kind;
    326 } BeamformerRenderBeamformedPushConstants;
    327 
    328 typedef struct {
    329 	f32 cycles;
    330 	f32 frequency;
    331 } BeamformerSineParameters;
    332 
    333 typedef struct {
    334 	f32 duration;
    335 	f32 min_frequency;
    336 	f32 max_frequency;
    337 } BeamformerChirpParameters;
    338 
    339 typedef struct {
    340 	BeamformerEmissionKind kind;
    341 	union {
    342 		BeamformerSineParameters  sine;
    343 		BeamformerChirpParameters chirp;
    344 	};
    345 } BeamformerEmissionParameters;
    346 
    347 typedef struct {
    348 	f32 cutoff_frequency;
    349 	f32 beta;
    350 	u32 length;
    351 } BeamformerKaiserFilterParameters;
    352 
    353 typedef struct {
    354 	f32 duration;
    355 	f32 min_frequency;
    356 	f32 max_frequency;
    357 } BeamformerMatchedChirpFilterParameters;
    358 
    359 typedef struct {
    360 	BeamformerFilterKind kind;
    361 	f32                  sampling_frequency;
    362 	b32                  complex;
    363 	union {
    364 		BeamformerKaiserFilterParameters       kaiser;
    365 		BeamformerMatchedChirpFilterParameters matched_chirp;
    366 	};
    367 } BeamformerFilterParameters;
    368 
    369 typedef struct {
    370 	m4                        das_voxel_transform;
    371 	m4                        xdc_transform;
    372 	v2                        xdc_element_pitch;
    373 	uv2                       raw_data_dimensions;
    374 	v2                        focal_vector;
    375 	u32                       transmit_receive_orientation;
    376 	u32                       sample_count;
    377 	u32                       channel_count;
    378 	u32                       acquisition_count;
    379 	BeamformerAcquisitionKind acquisition_kind;
    380 	BeamformerDecodeMode      decode_mode;
    381 	BeamformerSamplingMode    sampling_mode;
    382 	f32                       time_offset;
    383 	b32                       single_focus;
    384 	b32                       single_orientation;
    385 } BeamformerParametersHead;
    386 
    387 typedef struct {
    388 	iv4                         output_points;
    389 	f32                         sampling_frequency;
    390 	f32                         demodulation_frequency;
    391 	f32                         speed_of_sound;
    392 	f32                         f_number;
    393 	BeamformerInterpolationMode interpolation_mode;
    394 	b32                         coherency_weighting;
    395 	u32                         decimation_rate;
    396 } BeamformerUIParameters;
    397 
    398 typedef struct {
    399 	BeamformerContrastMode       contrast_mode;
    400 	BeamformerEmissionParameters emission_parameters;
    401 } BeamformerExtraParameters;
    402 
    403 typedef struct {
    404 	m4                           das_voxel_transform;
    405 	m4                           xdc_transform;
    406 	v2                           xdc_element_pitch;
    407 	uv2                          raw_data_dimensions;
    408 	v2                           focal_vector;
    409 	u32                          transmit_receive_orientation;
    410 	u32                          sample_count;
    411 	u32                          channel_count;
    412 	u32                          acquisition_count;
    413 	BeamformerAcquisitionKind    acquisition_kind;
    414 	BeamformerDecodeMode         decode_mode;
    415 	BeamformerSamplingMode       sampling_mode;
    416 	f32                          time_offset;
    417 	b32                          single_focus;
    418 	b32                          single_orientation;
    419 	iv4                          output_points;
    420 	f32                          sampling_frequency;
    421 	f32                          demodulation_frequency;
    422 	f32                          speed_of_sound;
    423 	f32                          f_number;
    424 	BeamformerInterpolationMode  interpolation_mode;
    425 	b32                          coherency_weighting;
    426 	u32                          decimation_rate;
    427 	BeamformerContrastMode       contrast_mode;
    428 	BeamformerEmissionParameters emission_parameters;
    429 } BeamformerParameters;
    430 
    431 typedef struct {
    432 	m4                           das_voxel_transform;
    433 	m4                           xdc_transform;
    434 	v2                           xdc_element_pitch;
    435 	uv2                          raw_data_dimensions;
    436 	v2                           focal_vector;
    437 	u32                          transmit_receive_orientation;
    438 	u32                          sample_count;
    439 	u32                          channel_count;
    440 	u32                          acquisition_count;
    441 	BeamformerAcquisitionKind    acquisition_kind;
    442 	BeamformerDecodeMode         decode_mode;
    443 	BeamformerSamplingMode       sampling_mode;
    444 	f32                          time_offset;
    445 	b32                          single_focus;
    446 	b32                          single_orientation;
    447 	iv4                          output_points;
    448 	f32                          sampling_frequency;
    449 	f32                          demodulation_frequency;
    450 	f32                          speed_of_sound;
    451 	f32                          f_number;
    452 	BeamformerInterpolationMode  interpolation_mode;
    453 	b32                          coherency_weighting;
    454 	u32                          decimation_rate;
    455 	BeamformerContrastMode       contrast_mode;
    456 	BeamformerEmissionParameters emission_parameters;
    457 	i16                          channel_mapping[BeamformerMaxChannelCount];
    458 	i16                          sparse_elements[BeamformerMaxEmissionsCount];
    459 	u8                           transmit_receive_orientations[BeamformerMaxEmissionsCount];
    460 	f32                          steering_angles[BeamformerMaxEmissionsCount];
    461 	f32                          focal_depths[BeamformerMaxEmissionsCount];
    462 	i32                          compute_stages[BeamformerMaxComputeShaderStages];
    463 	i32                          compute_stage_parameters[BeamformerMaxComputeShaderStages];
    464 	u32                          compute_stages_count;
    465 	BeamformerDataKind           data_kind;
    466 } BeamformerSimpleParameters;
    467 
    468 typedef struct {
    469 	u32 active;
    470 	u32 save_enabled;
    471 	u32 save_active;
    472 	u32 acquisition_kind;
    473 	u64 acquisition_kind_enabled_flags;
    474 	f32 transmit_power;
    475 	f32 image_plane_offsets[BeamformerViewPlaneTag_Count];
    476 	f32 tgc_control_points[8];
    477 	i32 save_name_tag_length;
    478 	u8  save_name_tag[128];
    479 } BeamformerLiveImagingParameters;
    480 
    481 typedef struct {
    482 	v2  focal_vectors[BeamformerMaxChannelCount];
    483 	i16 sparse_elements[BeamformerMaxChannelCount];
    484 	u16 transmit_receive_orientations[BeamformerMaxChannelCount];
    485 } BeamformerDASArrayParameters;
    486 
    487 typedef struct {
    488 	str8                 display;
    489 	str8                 string;
    490 	str8                 description;
    491 	BeamformerPanelFlags flags;
    492 } BeamformerPanelInfo;
    493 
    494 typedef struct {
    495 	str8 string;
    496 	u64  tree_node;
    497 	u64  window;
    498 	u64  frame;
    499 	u64  frame_view;
    500 	u64  split_axis;
    501 	u64  split_left_tree;
    502 	u64  split_right_tree;
    503 	u64  drop_target_tree;
    504 	u64  drop_child_index;
    505 } BeamformerRegisters;
    506 
    507 typedef struct {
    508 	str8 string;
    509 	str8 display;
    510 	str8 description;
    511 } BeamformerCommandInfo;
    512 
    513 typedef union {
    514 	BeamformerDecodeBakeParameters  Decode;
    515 	BeamformerFilterBakeParameters  Filter;
    516 	BeamformerDASBakeParameters     DAS;
    517 	BeamformerReshapeBakeParameters Reshape;
    518 } BeamformerShaderBakeParameters;
    519 
    520 read_only global u8 beamformer_data_kind_element_size[] = {
    521 	2,
    522 	2,
    523 	4,
    524 	4,
    525 	2,
    526 	2,
    527 };
    528 
    529 read_only global u8 beamformer_data_kind_element_count[] = {
    530 	1,
    531 	2,
    532 	1,
    533 	2,
    534 	1,
    535 	2,
    536 };
    537 
    538 read_only global u8 beamformer_data_kind_byte_size[] = {
    539 	2 * 1,
    540 	2 * 2,
    541 	4 * 1,
    542 	4 * 2,
    543 	2 * 1,
    544 	2 * 2,
    545 };
    546 
    547 read_only global b8 beamformer_data_kind_complex[] = {
    548 	0,
    549 	1,
    550 	0,
    551 	1,
    552 	0,
    553 	1,
    554 };
    555 
    556 read_only global s8 beamformer_data_kind_glsl_type[] = {
    557 	s8_comp("int16_t"),
    558 	s8_comp("i16vec2"),
    559 	s8_comp("float32_t"),
    560 	s8_comp("f32vec2"),
    561 	s8_comp("float16_t"),
    562 	s8_comp("f16vec2"),
    563 };
    564 
    565 read_only global s8 beamformer_data_kind_s8[] = {
    566 	s8_comp("Int16"),
    567 	s8_comp("Int16Complex"),
    568 	s8_comp("Float32"),
    569 	s8_comp("Float32Complex"),
    570 	s8_comp("Float16"),
    571 	s8_comp("Float16Complex"),
    572 };
    573 
    574 read_only global u8 beamformer_contrast_mode_samples[] = {
    575 	1,
    576 	3,
    577 };
    578 
    579 read_only global str8 beamformer_contrast_mode_strings[] = {
    580 	str8_comp("None"),
    581 	str8_comp("A1S2"),
    582 };
    583 
    584 read_only global str8 beamformer_view_plane_tag_strings[] = {
    585 	str8_comp("XZ"),
    586 	str8_comp("YZ"),
    587 	str8_comp("XY"),
    588 	str8_comp("Arbitrary"),
    589 };
    590 
    591 read_only global u8 beamformer_acquisition_kind_has_fixed_transmits[] = {
    592 	1,
    593 	0,
    594 	1,
    595 	0,
    596 	0,
    597 	0,
    598 	1,
    599 	1,
    600 	0,
    601 	0,
    602 	0,
    603 	0,
    604 	0,
    605 };
    606 
    607 read_only global str8 beamformer_acquisition_kind_strings[] = {
    608 	str8_comp("FORCES"),
    609 	str8_comp("UFORCES"),
    610 	str8_comp("HERCULES"),
    611 	str8_comp("VLS"),
    612 	str8_comp("TPW"),
    613 	str8_comp("UHERCULES"),
    614 	str8_comp("RACES"),
    615 	str8_comp("EPIC-FORCES"),
    616 	str8_comp("EPIC-UFORCES"),
    617 	str8_comp("EPIC-UHERCULES"),
    618 	str8_comp("Flash"),
    619 	str8_comp("HERO-PA"),
    620 	str8_comp("ULM"),
    621 };
    622 
    623 read_only global s8 beamformer_filter_kind_strings[] = {
    624 	s8_comp("Kaiser"),
    625 	s8_comp("MatchedChirp"),
    626 };
    627 
    628 read_only global s8 beamformer_interpolation_mode_strings[] = {
    629 	s8_comp("Nearest"),
    630 	s8_comp("Linear"),
    631 	s8_comp("Cubic"),
    632 };
    633 
    634 read_only global s8 beamformer_shader_resource_kind_strings[] = {
    635 	s8_comp("Buffer"),
    636 };
    637 
    638 read_only global BeamformerPanelInfo beamformer_panel_infos[] = {
    639 	{str8_comp(""), str8_comp("nil"), str8_comp(""), (0*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(0*BeamformerPanelFlags_HasSettings)},
    640 	{str8_comp(""), str8_comp("split"), str8_comp(""), (0*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(0*BeamformerPanelFlags_HasSettings)},
    641 	{str8_comp(""), str8_comp("group"), str8_comp(""), (0*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(0*BeamformerPanelFlags_HasSettings)},
    642 	{str8_comp("Compute Bar Graph"), str8_comp("compute_bar_graph"), str8_comp("Bar graph showing portions of compute occupied by each stage."), (1*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(0*BeamformerPanelFlags_HasSettings)},
    643 	{str8_comp("Compute Stats"), str8_comp("compute_stats"), str8_comp("Average stats about beamforming computations."), (1*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(0*BeamformerPanelFlags_HasSettings)},
    644 	{str8_comp("Frame View"), str8_comp("frame_view_live"), str8_comp("Latest frame with selected tag."), (1*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(1*BeamformerPanelFlags_HasSettings)},
    645 	{str8_comp("Frame View (Copy)"), str8_comp("frame_view_copy"), str8_comp("Copy of an old frame. Useful for comparisons."), (0*BeamformerPanelFlags_List)|(1*BeamformerPanelFlags_NeedsFrame)|(1*BeamformerPanelFlags_HasSettings)},
    646 	{str8_comp("3D X-Plane"), str8_comp("frame_view_xplane"), str8_comp("3D Cross Plane View."), (1*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(1*BeamformerPanelFlags_HasSettings)},
    647 	{str8_comp("Live Controls"), str8_comp("live_controls"), str8_comp("Imaging system controls."), (1*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(0*BeamformerPanelFlags_HasSettings)},
    648 	{str8_comp("Parameter Listing"), str8_comp("parameters_listing"), str8_comp("Editable parameter set used for beamforming."), (1*BeamformerPanelFlags_List)|(0*BeamformerPanelFlags_NeedsFrame)|(1*BeamformerPanelFlags_HasSettings)},
    649 };
    650 
    651 #define beamformer_registers_init_literal \
    652 	.string           = beamformer_registers()->string, \
    653 	.tree_node        = beamformer_registers()->tree_node, \
    654 	.window           = beamformer_registers()->window, \
    655 	.frame            = beamformer_registers()->frame, \
    656 	.frame_view       = beamformer_registers()->frame_view, \
    657 	.split_axis       = beamformer_registers()->split_axis, \
    658 	.split_left_tree  = beamformer_registers()->split_left_tree, \
    659 	.split_right_tree = beamformer_registers()->split_right_tree, \
    660 	.drop_target_tree = beamformer_registers()->drop_target_tree, \
    661 	.drop_child_index = beamformer_registers()->drop_child_index, \
    662 
    663 read_only global BeamformerCommandInfo beamformer_command_infos[] = {
    664 	{0},
    665 	{str8_comp("close_tab"), str8_comp("Close Tab"), str8_comp("Closes currently active tab.")},
    666 	{str8_comp("focus_tab"), str8_comp("Focus Tab"), str8_comp("Focus the currently selected tab in its group.")},
    667 	{str8_comp("move_tab"), str8_comp("Move Tab"), str8_comp("Moves an exisiting tab to a different group/split.")},
    668 	{str8_comp("open_tab"), str8_comp("Open Tab"), str8_comp("Opens a new tab with a specified view.")},
    669 	{str8_comp("split_tree"), str8_comp("Split Tree"), str8_comp("Splits the UI into two new splits.")},
    670 };
    671 
    672 read_only global s8 beamformer_shader_names[] = {
    673 	s8_comp("Decode"),
    674 	s8_comp("Filter"),
    675 	s8_comp("Demodulate"),
    676 	s8_comp("DAS"),
    677 	s8_comp("Sum"),
    678 	s8_comp("MinMax"),
    679 	s8_comp("Hilbert"),
    680 	s8_comp("CoherencyWeighting"),
    681 	s8_comp("Reshape"),
    682 	s8_comp("RenderBeamformed"),
    683 };
    684 
    685 read_only global BeamformerShaderKind beamformer_reloadable_shader_kinds[] = {
    686 	BeamformerShaderKind_Decode,
    687 	BeamformerShaderKind_Filter,
    688 	BeamformerShaderKind_DAS,
    689 	BeamformerShaderKind_Sum,
    690 	BeamformerShaderKind_MinMax,
    691 	BeamformerShaderKind_CoherencyWeighting,
    692 	BeamformerShaderKind_Reshape,
    693 	BeamformerShaderKind_RenderBeamformed,
    694 };
    695 
    696 read_only global s8 *beamformer_reloadable_shader_files[] = {
    697 	(s8 []){s8_comp("decode.glsl")},
    698 	(s8 []){s8_comp("filter.glsl")},
    699 	(s8 []){s8_comp("das.glsl")},
    700 	(s8 []){s8_comp("sum.glsl")},
    701 	(s8 []){s8_comp("min_max.glsl")},
    702 	(s8 []){s8_comp("coherency_weighting.glsl")},
    703 	(s8 []){s8_comp("reshape.glsl")},
    704 	(s8 []){s8_comp("render_3d.vert.glsl"), s8_comp("render_3d.frag.glsl")},
    705 };
    706 
    707 read_only global i32 beamformer_shader_reloadable_index_by_shader[] = {
    708 	0,
    709 	1,
    710 	1,
    711 	2,
    712 	3,
    713 	4,
    714 	-1,
    715 	5,
    716 	6,
    717 	7,
    718 };
    719 
    720 read_only global i32 beamformer_reloadable_compute_shader_info_indices[] = {
    721 	0,
    722 	1,
    723 	2,
    724 	3,
    725 	4,
    726 };
    727 
    728 read_only global i32 beamformer_reloadable_compute_helpers_shader_info_indices[] = {
    729 	5,
    730 	6,
    731 };
    732 
    733 read_only global i32 beamformer_reloadable_render_shader_info_indices[] = {
    734 	7,
    735 };
    736 
    737 read_only global s8 beamformer_shader_global_header_strings[] = {
    738 	s8_comp(""
    739 	"#define DecodeMode_None     0\n"
    740 	"#define DecodeMode_Hadamard 1\n"
    741 	"\n"),
    742 	s8_comp(""
    743 	"layout(push_constant, std430) uniform PushConstants {\n"
    744 	"  uint64_t hadamard_buffer;\n"
    745 	"  uint64_t rf_buffer;\n"
    746 	"  uint64_t output_buffer;\n"
    747 	"};\n"
    748 	"\n"),
    749 	s8_comp(""
    750 	"#define ShaderBufferSlot_BeamformedData 0\n"
    751 	"#define ShaderBufferSlot_PingPong       1\n"
    752 	"\n"),
    753 	s8_comp(""
    754 	"#define ShaderResourceKind_Buffer 0\n"
    755 	"\n"),
    756 	s8_comp(""
    757 	"layout(push_constant, std430) uniform PushConstants {\n"
    758 	"  uint64_t input_data;\n"
    759 	"  uint64_t filter_coefficients;\n"
    760 	"  uint32_t output_element_offset;\n"
    761 	"};\n"
    762 	"\n"),
    763 	s8_comp("#define MaxChannelCount (256)\n\n"),
    764 	s8_comp(""
    765 	"#define AcquisitionKind_FORCES         0\n"
    766 	"#define AcquisitionKind_UFORCES        1\n"
    767 	"#define AcquisitionKind_HERCULES       2\n"
    768 	"#define AcquisitionKind_RCA_VLS        3\n"
    769 	"#define AcquisitionKind_RCA_TPW        4\n"
    770 	"#define AcquisitionKind_UHERCULES      5\n"
    771 	"#define AcquisitionKind_RACES          6\n"
    772 	"#define AcquisitionKind_EPIC_FORCES    7\n"
    773 	"#define AcquisitionKind_EPIC_UFORCES   8\n"
    774 	"#define AcquisitionKind_EPIC_UHERCULES 9\n"
    775 	"#define AcquisitionKind_Flash          10\n"
    776 	"#define AcquisitionKind_HERO_PA        11\n"
    777 	"#define AcquisitionKind_ULM            12\n"
    778 	"\n"),
    779 	s8_comp(""
    780 	"#define InterpolationMode_Nearest 0\n"
    781 	"#define InterpolationMode_Linear  1\n"
    782 	"#define InterpolationMode_Cubic   2\n"
    783 	"\n"),
    784 	s8_comp(""
    785 	"#define RCAOrientation_None    0\n"
    786 	"#define RCAOrientation_Rows    1\n"
    787 	"#define RCAOrientation_Columns 2\n"
    788 	"\n"),
    789 	s8_comp(""
    790 	"struct DASArrayParameters {\n"
    791 	"  f32vec2  focal_vectors[MaxChannelCount];\n"
    792 	"  int16_t  sparse_elements[MaxChannelCount];\n"
    793 	"  uint16_t transmit_receive_orientations[MaxChannelCount];\n"
    794 	"};\n"
    795 	"\n"),
    796 	s8_comp(""
    797 	"layout(push_constant, std430) uniform PushConstants {\n"
    798 	"  f32mat4  xdc_transform;\n"
    799 	"  f32mat4  voxel_transform;\n"
    800 	"  f32vec2  xdc_element_pitch;\n"
    801 	"  uint64_t array_parameters;\n"
    802 	"  uint64_t output_frame;\n"
    803 	"  uint64_t incoherent_frame;\n"
    804 	"  uint32_t rf_element_offset;\n"
    805 	"  uint32_t output_size_x;\n"
    806 	"  uint32_t output_size_y;\n"
    807 	"  uint32_t output_size_z;\n"
    808 	"  uint32_t cycle_t;\n"
    809 	"  int32_t  channel_offset;\n"
    810 	"};\n"
    811 	"\n"),
    812 	s8_comp(""
    813 	"layout(push_constant, std430) uniform PushConstants {\n"
    814 	"  uint64_t  output_data;\n"
    815 	"  uint64_t  input_data;\n"
    816 	"  uint32_t  image_elements;\n"
    817 	"  float32_t scale;\n"
    818 	"};\n"
    819 	"\n"),
    820 	s8_comp(""
    821 	"layout(push_constant, std430) uniform PushConstants {\n"
    822 	"  uint64_t  left_side_buffer;\n"
    823 	"  uint64_t  right_side_buffer;\n"
    824 	"  float32_t scale;\n"
    825 	"  uint32_t  output_size_x;\n"
    826 	"  uint32_t  output_size_y;\n"
    827 	"  uint32_t  output_size_z;\n"
    828 	"};\n"
    829 	"\n"),
    830 	s8_comp(""
    831 	"layout(push_constant, std430) uniform PushConstants {\n"
    832 	"  uint64_t output_buffer;\n"
    833 	"  uint64_t left_input_buffer;\n"
    834 	"  uint64_t right_input_buffer;\n"
    835 	"};\n"
    836 	"\n"),
    837 	s8_comp(""
    838 	"layout(push_constant, std430) uniform PushConstants {\n"
    839 	"  f32mat4   mvp_matrix;\n"
    840 	"  uint64_t  positions;\n"
    841 	"  uint64_t  normals;\n"
    842 	"  f32vec4   bounding_box_colour;\n"
    843 	"  float32_t bounding_box_fraction;\n"
    844 	"  float32_t db_cutoff;\n"
    845 	"  float32_t threshold;\n"
    846 	"  float32_t gamma;\n"
    847 	"  uint64_t  input_data;\n"
    848 	"  uint32_t  input_size_x;\n"
    849 	"  uint32_t  input_size_y;\n"
    850 	"  uint32_t  input_size_z;\n"
    851 	"  uint32_t  data_kind;\n"
    852 	"};\n"
    853 	"\n"),
    854 };
    855 
    856 read_only global b8 beamformer_shader_has_primitive[] = {
    857 	0,
    858 	0,
    859 	0,
    860 	0,
    861 	0,
    862 	0,
    863 	0,
    864 	1,
    865 };
    866 
    867 read_only global b8 beamformer_shader_primitive_is_vertex[] = {
    868 	0,
    869 	0,
    870 	0,
    871 	0,
    872 	0,
    873 	0,
    874 	0,
    875 	1,
    876 };
    877 
    878 read_only global i32 *beamformer_shader_header_vectors[] = {
    879 	(i32 []){0, 1},
    880 	(i32 []){2, 3, 4},
    881 	(i32 []){5, 6, 7, 8, 2, 3, 9, 10},
    882 	(i32 []){11},
    883 	0,
    884 	(i32 []){12},
    885 	(i32 []){13},
    886 	(i32 []){14},
    887 };
    888 
    889 read_only global i32 beamformer_shader_header_vector_lengths[] = {
    890 	2,
    891 	3,
    892 	8,
    893 	1,
    894 	0,
    895 	1,
    896 	1,
    897 	1,
    898 };
    899 
    900 read_only global s8 *beamformer_shader_bake_parameter_names[] = {
    901 	(s8 []){
    902 		s8_comp("UseSharedMemory"),
    903 		s8_comp("DecodeMode"),
    904 		s8_comp("OutputChannelStride"),
    905 		s8_comp("OutputSampleStride"),
    906 		s8_comp("OutputTransmitStride"),
    907 		s8_comp("ToProcess"),
    908 		s8_comp("TransmitCount"),
    909 		s8_comp("ChunkChannelCount"),
    910 		s8_comp("CooperativeMatrix"),
    911 		s8_comp("CooperativeMatrixM"),
    912 		s8_comp("CooperativeMatrixN"),
    913 		s8_comp("CooperativeMatrixK"),
    914 	},
    915 	(s8 []){
    916 		s8_comp("Demodulate"),
    917 		s8_comp("ComplexFilter"),
    918 		s8_comp("DecimationRate"),
    919 		s8_comp("FilterLength"),
    920 		s8_comp("InputChannelStride"),
    921 		s8_comp("InputSampleStride"),
    922 		s8_comp("InputTransmitStride"),
    923 		s8_comp("OutputChannelStride"),
    924 		s8_comp("OutputSampleStride"),
    925 		s8_comp("OutputTransmitStride"),
    926 		s8_comp("SampleCount"),
    927 		s8_comp("BatchSampleCount"),
    928 		s8_comp("DemodulationFrequency"),
    929 		s8_comp("SamplingFrequency"),
    930 	},
    931 	(s8 []){
    932 		s8_comp("CoherencyWeighting"),
    933 		s8_comp("SingleFocus"),
    934 		s8_comp("SingleOrientation"),
    935 		s8_comp("Sparse"),
    936 		s8_comp("AcquisitionCount"),
    937 		s8_comp("AcquisitionKind"),
    938 		s8_comp("ChannelCount"),
    939 		s8_comp("ChunkChannelCount"),
    940 		s8_comp("InterpolationMode"),
    941 		s8_comp("SampleCount"),
    942 		s8_comp("TransmitReceiveOrientation"),
    943 		s8_comp("DemodulationFrequency"),
    944 		s8_comp("FNumber"),
    945 		s8_comp("FocusDepth"),
    946 		s8_comp("SamplingFrequency"),
    947 		s8_comp("SpeedOfSound"),
    948 		s8_comp("TimeOffset"),
    949 		s8_comp("TransmitAngle"),
    950 	},
    951 	0,
    952 	0,
    953 	0,
    954 	(s8 []){
    955 		s8_comp("SizeX"),
    956 		s8_comp("SizeY"),
    957 		s8_comp("SizeZ"),
    958 		s8_comp("InputStrideX"),
    959 		s8_comp("InputStrideY"),
    960 		s8_comp("InputStrideZ"),
    961 		s8_comp("OutputStrideX"),
    962 		s8_comp("OutputStrideY"),
    963 		s8_comp("OutputStrideZ"),
    964 		s8_comp("Interleave"),
    965 		s8_comp("Deinterleave"),
    966 	},
    967 	0,
    968 };
    969 
    970 read_only global u32 beamformer_shader_bake_parameter_float_bits[] = {
    971 	0x00000000UL,
    972 	0x00003000UL,
    973 	0x0003f800UL,
    974 	0x00000000UL,
    975 	0x00000000UL,
    976 	0x00000000UL,
    977 	0x00000000UL,
    978 	0x00000000UL,
    979 };
    980 
    981 read_only global u8 beamformer_shader_bake_parameter_counts[] = {
    982 	12,
    983 	14,
    984 	18,
    985 	0,
    986 	0,
    987 	0,
    988 	11,
    989 	0,
    990 };
    991 
    992 read_only global u8 beamformer_shader_push_constant_sizes[] = {
    993 	sizeof(BeamformerDecodePushConstants),
    994 	sizeof(BeamformerFilterPushConstants),
    995 	sizeof(BeamformerDASPushConstants),
    996 	sizeof(BeamformerSumPushConstants),
    997 	0,
    998 	sizeof(BeamformerCoherencyWeightingPushConstants),
    999 	sizeof(BeamformerReshapePushConstants),
   1000 	sizeof(BeamformerRenderBeamformedPushConstants),
   1001 };
   1002