beamformer.meta.c (15519B)
1 /* See LICENSE for license details. */ 2 3 // GENERATED CODE 4 5 // NOTE: Constants (Integer) 6 #define BeamformerFilterSlots (4) 7 #define BeamformerMaxBacklogFrames (16) 8 #define BeamformerMaxChannelCount (256) 9 #define BeamformerMaxEmissionsCount (256) 10 #define BeamformerMaxComputeShaderStages (16) 11 #define BeamformerMaxParameterBlocks (16) 12 #define BeamformerMaxRawDataFramesInFlight (3) 13 14 // NOTE: Constants (Float) 15 16 typedef enum { 17 BeamformerDecodeMode_None = 0, 18 BeamformerDecodeMode_Hadamard = 1, 19 BeamformerDecodeMode_Count, 20 } BeamformerDecodeMode; 21 22 typedef enum { 23 BeamformerRCAOrientation_None = 0, 24 BeamformerRCAOrientation_Rows = 1, 25 BeamformerRCAOrientation_Columns = 2, 26 BeamformerRCAOrientation_Count, 27 } BeamformerRCAOrientation; 28 29 typedef enum { 30 BeamformerSamplingMode_2X = 0, 31 BeamformerSamplingMode_4X = 1, 32 BeamformerSamplingMode_Count, 33 } BeamformerSamplingMode; 34 35 typedef enum { 36 BeamformerDataKind_Int16 = 0, 37 BeamformerDataKind_Int16Complex = 1, 38 BeamformerDataKind_Float32 = 2, 39 BeamformerDataKind_Float32Complex = 3, 40 BeamformerDataKind_Float16 = 4, 41 BeamformerDataKind_Float16Complex = 5, 42 BeamformerDataKind_Count, 43 } BeamformerDataKind; 44 45 typedef enum { 46 BeamformerContrastMode_None = 0, 47 BeamformerContrastMode_A1S2 = 1, 48 BeamformerContrastMode_Count, 49 } BeamformerContrastMode; 50 51 typedef enum { 52 BeamformerEmissionKind_Sine = 0, 53 BeamformerEmissionKind_Chirp = 1, 54 BeamformerEmissionKind_Count, 55 } BeamformerEmissionKind; 56 57 typedef enum { 58 BeamformerInterpolationMode_Nearest = 0, 59 BeamformerInterpolationMode_Linear = 1, 60 BeamformerInterpolationMode_Cubic = 2, 61 BeamformerInterpolationMode_Count, 62 } BeamformerInterpolationMode; 63 64 typedef enum { 65 BeamformerFilterKind_Kaiser = 0, 66 BeamformerFilterKind_MatchedChirp = 1, 67 BeamformerFilterKind_Count, 68 } BeamformerFilterKind; 69 70 typedef enum { 71 BeamformerAcquisitionKind_FORCES = 0, 72 BeamformerAcquisitionKind_UFORCES = 1, 73 BeamformerAcquisitionKind_HERCULES = 2, 74 BeamformerAcquisitionKind_RCA_VLS = 3, 75 BeamformerAcquisitionKind_RCA_TPW = 4, 76 BeamformerAcquisitionKind_UHERCULES = 5, 77 BeamformerAcquisitionKind_RACES = 6, 78 BeamformerAcquisitionKind_EPIC_FORCES = 7, 79 BeamformerAcquisitionKind_EPIC_UFORCES = 8, 80 BeamformerAcquisitionKind_EPIC_UHERCULES = 9, 81 BeamformerAcquisitionKind_Flash = 10, 82 BeamformerAcquisitionKind_HERO_PA = 11, 83 BeamformerAcquisitionKind_Count, 84 } BeamformerAcquisitionKind; 85 86 typedef enum { 87 BeamformerShaderKind_CudaDecode = 0, 88 BeamformerShaderKind_CudaHilbert = 1, 89 BeamformerShaderKind_Decode = 2, 90 BeamformerShaderKind_Filter = 3, 91 BeamformerShaderKind_Demodulate = 4, 92 BeamformerShaderKind_DAS = 5, 93 BeamformerShaderKind_MinMax = 6, 94 BeamformerShaderKind_Sum = 7, 95 BeamformerShaderKind_Render3D = 8, 96 BeamformerShaderKind_Count, 97 98 BeamformerShaderKind_ComputeFirst = BeamformerShaderKind_CudaDecode, 99 BeamformerShaderKind_ComputeLast = BeamformerShaderKind_Sum, 100 BeamformerShaderKind_ComputeCount = 8, 101 BeamformerShaderKind_RenderFirst = BeamformerShaderKind_Render3D, 102 BeamformerShaderKind_RenderLast = BeamformerShaderKind_Render3D, 103 BeamformerShaderKind_RenderCount = 1, 104 } BeamformerShaderKind; 105 106 typedef struct { 107 u32 data_kind; 108 u32 dilate_output; 109 u32 use_shared_memory; 110 u32 decode_mode; 111 u32 input_channel_stride; 112 u32 input_sample_stride; 113 u32 input_transmit_stride; 114 u32 output_channel_stride; 115 u32 output_sample_stride; 116 u32 output_transmit_stride; 117 u32 to_process; 118 u32 transmit_count; 119 } BeamformerDecodeBakeParameters; 120 121 typedef struct { 122 u32 data_kind; 123 u32 demodulate; 124 u32 complex_filter; 125 u32 output_floats; 126 u32 decimation_rate; 127 u32 filter_length; 128 u32 input_channel_stride; 129 u32 input_sample_stride; 130 u32 input_transmit_stride; 131 u32 output_channel_stride; 132 u32 output_sample_stride; 133 u32 output_transmit_stride; 134 u32 sample_count; 135 f32 demodulation_frequency; 136 f32 sampling_frequency; 137 } BeamformerFilterBakeParameters; 138 139 typedef struct { 140 u32 data_kind; 141 u32 coherency_weighting; 142 u32 single_focus; 143 u32 single_orientation; 144 u32 fast; 145 u32 sparse; 146 u32 acquisition_count; 147 u32 acquisition_kind; 148 u32 channel_count; 149 u32 interpolation_mode; 150 u32 sample_count; 151 u32 transmit_receive_orientation; 152 f32 demodulation_frequency; 153 f32 f_number; 154 f32 focus_depth; 155 f32 sampling_frequency; 156 f32 speed_of_sound; 157 f32 time_offset; 158 f32 transmit_angle; 159 } BeamformerDASBakeParameters; 160 161 typedef struct { 162 m4 xdc_transform; 163 m4 voxel_transform; 164 v2 xdc_element_pitch; 165 } BeamformerDASPushConstants; 166 167 typedef struct { 168 f32 cycles; 169 f32 frequency; 170 } BeamformerSineParameters; 171 172 typedef struct { 173 f32 duration; 174 f32 min_frequency; 175 f32 max_frequency; 176 } BeamformerChirpParameters; 177 178 typedef struct { 179 BeamformerEmissionKind kind; 180 union { 181 BeamformerSineParameters sine; 182 BeamformerChirpParameters chirp; 183 }; 184 } BeamformerEmissionParameters; 185 186 typedef struct { 187 f32 cutoff_frequency; 188 f32 beta; 189 u32 length; 190 } BeamformerKaiserFilterParameters; 191 192 typedef struct { 193 f32 duration; 194 f32 min_frequency; 195 f32 max_frequency; 196 } BeamformerMatchedChirpFilterParameters; 197 198 typedef struct { 199 BeamformerFilterKind kind; 200 f32 sampling_frequency; 201 b32 complex; 202 union { 203 BeamformerKaiserFilterParameters kaiser; 204 BeamformerMatchedChirpFilterParameters matched_chirp; 205 }; 206 } BeamformerFilterParameters; 207 208 typedef struct { 209 m4 das_voxel_transform; 210 m4 xdc_transform; 211 v2 xdc_element_pitch; 212 uv2 raw_data_dimensions; 213 v2 focal_vector; 214 u32 transmit_receive_orientation; 215 u32 sample_count; 216 u32 channel_count; 217 u32 acquisition_count; 218 BeamformerAcquisitionKind acquisition_kind; 219 BeamformerDecodeMode decode_mode; 220 BeamformerSamplingMode sampling_mode; 221 f32 time_offset; 222 b32 single_focus; 223 b32 single_orientation; 224 } BeamformerParametersHead; 225 226 typedef struct { 227 iv4 output_points; 228 f32 sampling_frequency; 229 f32 demodulation_frequency; 230 f32 speed_of_sound; 231 f32 f_number; 232 BeamformerInterpolationMode interpolation_mode; 233 b32 coherency_weighting; 234 u32 decimation_rate; 235 } BeamformerUIParameters; 236 237 typedef struct { 238 BeamformerContrastMode contrast_mode; 239 BeamformerEmissionParameters emission_parameters; 240 } BeamformerExtraParameters; 241 242 typedef struct { 243 m4 das_voxel_transform; 244 m4 xdc_transform; 245 v2 xdc_element_pitch; 246 uv2 raw_data_dimensions; 247 v2 focal_vector; 248 u32 transmit_receive_orientation; 249 u32 sample_count; 250 u32 channel_count; 251 u32 acquisition_count; 252 BeamformerAcquisitionKind acquisition_kind; 253 BeamformerDecodeMode decode_mode; 254 BeamformerSamplingMode sampling_mode; 255 f32 time_offset; 256 b32 single_focus; 257 b32 single_orientation; 258 iv4 output_points; 259 f32 sampling_frequency; 260 f32 demodulation_frequency; 261 f32 speed_of_sound; 262 f32 f_number; 263 BeamformerInterpolationMode interpolation_mode; 264 b32 coherency_weighting; 265 u32 decimation_rate; 266 BeamformerContrastMode contrast_mode; 267 BeamformerEmissionParameters emission_parameters; 268 } BeamformerParameters; 269 270 typedef struct { 271 m4 das_voxel_transform; 272 m4 xdc_transform; 273 v2 xdc_element_pitch; 274 uv2 raw_data_dimensions; 275 v2 focal_vector; 276 u32 transmit_receive_orientation; 277 u32 sample_count; 278 u32 channel_count; 279 u32 acquisition_count; 280 BeamformerAcquisitionKind acquisition_kind; 281 BeamformerDecodeMode decode_mode; 282 BeamformerSamplingMode sampling_mode; 283 f32 time_offset; 284 b32 single_focus; 285 b32 single_orientation; 286 iv4 output_points; 287 f32 sampling_frequency; 288 f32 demodulation_frequency; 289 f32 speed_of_sound; 290 f32 f_number; 291 BeamformerInterpolationMode interpolation_mode; 292 b32 coherency_weighting; 293 u32 decimation_rate; 294 BeamformerContrastMode contrast_mode; 295 BeamformerEmissionParameters emission_parameters; 296 i16 channel_mapping[BeamformerMaxChannelCount]; 297 i16 sparse_elements[BeamformerMaxEmissionsCount]; 298 u8 transmit_receive_orientations[BeamformerMaxEmissionsCount]; 299 f32 steering_angles[BeamformerMaxEmissionsCount]; 300 f32 focal_depths[BeamformerMaxEmissionsCount]; 301 i32 compute_stages[BeamformerMaxComputeShaderStages]; 302 i32 compute_stage_parameters[BeamformerMaxComputeShaderStages]; 303 u32 compute_stages_count; 304 BeamformerDataKind data_kind; 305 } BeamformerSimpleParameters; 306 307 typedef union { 308 BeamformerDecodeBakeParameters Decode; 309 BeamformerFilterBakeParameters Filter; 310 BeamformerDASBakeParameters DAS; 311 } BeamformerShaderBakeParameters; 312 313 read_only global u8 beamformer_data_kind_element_size[] = { 314 2, 315 2, 316 4, 317 4, 318 2, 319 2, 320 }; 321 322 read_only global u8 beamformer_data_kind_element_count[] = { 323 1, 324 2, 325 1, 326 2, 327 1, 328 2, 329 }; 330 331 read_only global u8 beamformer_data_kind_byte_size[] = { 332 2 * 1, 333 2 * 2, 334 4 * 1, 335 4 * 2, 336 2 * 1, 337 2 * 2, 338 }; 339 340 read_only global b8 beamformer_data_kind_complex[] = { 341 0, 342 1, 343 0, 344 1, 345 0, 346 1, 347 }; 348 349 read_only global u8 beamformer_contrast_mode_samples[] = { 350 1, 351 3, 352 }; 353 354 read_only global u8 beamformer_acquisition_kind_has_fixed_transmits[] = { 355 1, 356 0, 357 1, 358 0, 359 0, 360 0, 361 1, 362 1, 363 0, 364 0, 365 0, 366 0, 367 }; 368 369 read_only global s8 beamformer_acquisition_kind_strings[] = { 370 s8_comp("FORCES"), 371 s8_comp("UFORCES"), 372 s8_comp("HERCULES"), 373 s8_comp("VLS"), 374 s8_comp("TPW"), 375 s8_comp("UHERCULES"), 376 s8_comp("RACES"), 377 s8_comp("EPIC-FORCES"), 378 s8_comp("EPIC-UFORCES"), 379 s8_comp("EPIC-UHERCULES"), 380 s8_comp("Flash"), 381 s8_comp("HERO-PA"), 382 }; 383 384 read_only global s8 beamformer_filter_kind_strings[] = { 385 s8_comp("Kaiser"), 386 s8_comp("MatchedChirp"), 387 }; 388 389 read_only global s8 beamformer_interpolation_mode_strings[] = { 390 s8_comp("Nearest"), 391 s8_comp("Linear"), 392 s8_comp("Cubic"), 393 }; 394 395 read_only global s8 beamformer_shader_names[] = { 396 s8_comp("CudaDecode"), 397 s8_comp("CudaHilbert"), 398 s8_comp("Decode"), 399 s8_comp("Filter"), 400 s8_comp("Demodulate"), 401 s8_comp("DAS"), 402 s8_comp("MinMax"), 403 s8_comp("Sum"), 404 s8_comp("Render3D"), 405 }; 406 407 read_only global BeamformerShaderKind beamformer_reloadable_shader_kinds[] = { 408 BeamformerShaderKind_Decode, 409 BeamformerShaderKind_Filter, 410 BeamformerShaderKind_DAS, 411 BeamformerShaderKind_MinMax, 412 BeamformerShaderKind_Sum, 413 BeamformerShaderKind_Render3D, 414 }; 415 416 read_only global s8 beamformer_reloadable_shader_files[] = { 417 s8_comp("decode.glsl"), 418 s8_comp("filter.glsl"), 419 s8_comp("das.glsl"), 420 s8_comp("min_max.glsl"), 421 s8_comp("sum.glsl"), 422 s8_comp("render_3d.frag.glsl"), 423 }; 424 425 read_only global i32 beamformer_shader_reloadable_index_by_shader[] = { 426 -1, 427 -1, 428 0, 429 1, 430 1, 431 2, 432 3, 433 4, 434 5, 435 }; 436 437 read_only global i32 beamformer_reloadable_compute_shader_info_indices[] = { 438 0, 439 1, 440 2, 441 3, 442 4, 443 }; 444 445 read_only global i32 beamformer_reloadable_render_shader_info_indices[] = { 446 5, 447 }; 448 449 read_only global s8 beamformer_shader_global_header_strings[] = { 450 s8_comp("" 451 "#define DataKind_Int16 0\n" 452 "#define DataKind_Int16Complex 1\n" 453 "#define DataKind_Float32 2\n" 454 "#define DataKind_Float32Complex 3\n" 455 "#define DataKind_Float16 4\n" 456 "#define DataKind_Float16Complex 5\n" 457 "\n"), 458 s8_comp("" 459 "#define DecodeMode_None 0\n" 460 "#define DecodeMode_Hadamard 1\n" 461 "\n"), 462 s8_comp("" 463 "#define AcquisitionKind_FORCES 0\n" 464 "#define AcquisitionKind_UFORCES 1\n" 465 "#define AcquisitionKind_HERCULES 2\n" 466 "#define AcquisitionKind_RCA_VLS 3\n" 467 "#define AcquisitionKind_RCA_TPW 4\n" 468 "#define AcquisitionKind_UHERCULES 5\n" 469 "#define AcquisitionKind_RACES 6\n" 470 "#define AcquisitionKind_EPIC_FORCES 7\n" 471 "#define AcquisitionKind_EPIC_UFORCES 8\n" 472 "#define AcquisitionKind_EPIC_UHERCULES 9\n" 473 "#define AcquisitionKind_Flash 10\n" 474 "#define AcquisitionKind_HERO_PA 11\n" 475 "\n"), 476 s8_comp("" 477 "#define InterpolationMode_Nearest 0\n" 478 "#define InterpolationMode_Linear 1\n" 479 "#define InterpolationMode_Cubic 2\n" 480 "\n"), 481 s8_comp("" 482 "#define RCAOrientation_None 0\n" 483 "#define RCAOrientation_Rows 1\n" 484 "#define RCAOrientation_Columns 2\n" 485 "\n"), 486 s8_comp("" 487 "layout(std140, binding = 0) uniform PushConstants {\n" 488 " mat4 xdc_transform;\n" 489 " mat4 voxel_transform;\n" 490 " vec2 xdc_element_pitch;\n" 491 "};\n" 492 "\n"), 493 }; 494 495 read_only global i32 *beamformer_shader_header_vectors[] = { 496 (i32 []){0, 1}, 497 (i32 []){0}, 498 (i32 []){2, 0, 3, 4, 5}, 499 0, 500 0, 501 0, 502 }; 503 504 read_only global i32 beamformer_shader_header_vector_lengths[] = { 505 2, 506 1, 507 5, 508 0, 509 0, 510 0, 511 }; 512 513 read_only global s8 *beamformer_shader_bake_parameter_names[] = { 514 (s8 []){ 515 s8_comp("DataKind"), 516 s8_comp("DilateOutput"), 517 s8_comp("UseSharedMemory"), 518 s8_comp("DecodeMode"), 519 s8_comp("InputChannelStride"), 520 s8_comp("InputSampleStride"), 521 s8_comp("InputTransmitStride"), 522 s8_comp("OutputChannelStride"), 523 s8_comp("OutputSampleStride"), 524 s8_comp("OutputTransmitStride"), 525 s8_comp("ToProcess"), 526 s8_comp("TransmitCount"), 527 }, 528 (s8 []){ 529 s8_comp("DataKind"), 530 s8_comp("Demodulate"), 531 s8_comp("ComplexFilter"), 532 s8_comp("OutputFloats"), 533 s8_comp("DecimationRate"), 534 s8_comp("FilterLength"), 535 s8_comp("InputChannelStride"), 536 s8_comp("InputSampleStride"), 537 s8_comp("InputTransmitStride"), 538 s8_comp("OutputChannelStride"), 539 s8_comp("OutputSampleStride"), 540 s8_comp("OutputTransmitStride"), 541 s8_comp("SampleCount"), 542 s8_comp("DemodulationFrequency"), 543 s8_comp("SamplingFrequency"), 544 }, 545 (s8 []){ 546 s8_comp("DataKind"), 547 s8_comp("CoherencyWeighting"), 548 s8_comp("SingleFocus"), 549 s8_comp("SingleOrientation"), 550 s8_comp("Fast"), 551 s8_comp("Sparse"), 552 s8_comp("AcquisitionCount"), 553 s8_comp("AcquisitionKind"), 554 s8_comp("ChannelCount"), 555 s8_comp("InterpolationMode"), 556 s8_comp("SampleCount"), 557 s8_comp("TransmitReceiveOrientation"), 558 s8_comp("DemodulationFrequency"), 559 s8_comp("FNumber"), 560 s8_comp("FocusDepth"), 561 s8_comp("SamplingFrequency"), 562 s8_comp("SpeedOfSound"), 563 s8_comp("TimeOffset"), 564 s8_comp("TransmitAngle"), 565 }, 566 0, 567 0, 568 0, 569 }; 570 571 read_only global u32 beamformer_shader_bake_parameter_float_bits[] = { 572 0x00000000UL, 573 0x00006000UL, 574 0x0007f000UL, 575 0x00000000UL, 576 0x00000000UL, 577 0x00000000UL, 578 }; 579 580 read_only global u8 beamformer_shader_bake_parameter_counts[] = { 581 12, 582 15, 583 19, 584 0, 585 0, 586 0, 587 }; 588