MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ upload_audio_to_gpu()

void MayaFlux::Buffers::upload_audio_to_gpu ( const std::shared_ptr< AudioBuffer > &  audio_buffer,
const std::shared_ptr< VKBuffer > &  gpu_buffer,
const std::shared_ptr< VKBuffer > &  staging = nullptr 
)

Upload AudioBuffer to GPU (always double precision)

Parameters
audio_bufferSource audio buffer (double[])
gpu_bufferTarget GPU buffer (must support R64Sfloat format)
stagingOptional staging buffer (auto-created if needed)

AudioBuffer is always double precision. This function ensures the GPU buffer is configured for double precision and performs a direct upload with no conversion.

Exceptions
std::runtime_errorif gpu_buffer doesn't support double precision

Definition at line 408 of file StagingUtils.cpp.

412{
413 if (gpu_buffer->get_format() != vk::Format::eR64Sfloat && gpu_buffer->get_format() != vk::Format::eUndefined) {
414 MF_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing,
415 "GPU buffer format is {} but audio requires R64Sfloat for double precision. "
416 "Create VKBuffer with DataModality::AUDIO_1D or AUDIO_MULTICHANNEL.",
417 vk::to_string(gpu_buffer->get_format()));
418 error<std::runtime_error>(
419 Journal::Component::Buffers,
420 Journal::Context::BufferProcessing,
421 std::source_location::current(),
422 "GPU buffer format mismatch for audio upload");
423 }
424
425 auto& audio_data = audio_buffer->get_data();
426
427 if (audio_data.empty()) {
428 MF_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing,
429 "AudioBuffer contains no data to upload");
430 return;
431 }
432
433 const void* data_ptr = audio_data.data();
434 size_t data_bytes = audio_data.size() * sizeof(double);
435
436 upload_to_gpu(data_ptr, data_bytes, gpu_buffer, staging);
437
438 MF_DEBUG(Journal::Component::Buffers, Journal::Context::BufferProcessing,
439 "Uploaded {} bytes of double-precision audio to GPU", data_bytes);
440}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MF_DEBUG, MF_ERROR, and upload_to_gpu().

Referenced by MayaFlux::Buffers::TransferProcessor::process_audio_to_gpu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: