ogl_beamforming

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

beamformer.c (23815B)


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