MayaFlux 0.3.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 378 of file StagingUtils.cpp.

382{
383 if (gpu_buffer->get_format() != vk::Format::eR64Sfloat && gpu_buffer->get_format() != vk::Format::eUndefined) {
384 MF_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing,
385 "GPU buffer format is {} but audio requires R64Sfloat for double precision. "
386 "Create VKBuffer with DataModality::AUDIO_1D or AUDIO_MULTICHANNEL.",
387 vk::to_string(gpu_buffer->get_format()));
388 error<std::runtime_error>(
389 Journal::Component::Buffers,
390 Journal::Context::BufferProcessing,
391 std::source_location::current(),
392 "GPU buffer format mismatch for audio upload");
393 }
394
395 auto& audio_data = audio_buffer->get_data();
396
397 if (audio_data.empty()) {
398 MF_ERROR(Journal::Component::Buffers, Journal::Context::BufferProcessing,
399 "AudioBuffer contains no data to upload");
400 return;
401 }
402
403 const void* data_ptr = audio_data.data();
404 size_t data_bytes = audio_data.size() * sizeof(double);
405
406 upload_to_gpu(data_ptr, data_bytes, gpu_buffer, staging);
407
408 MF_DEBUG(Journal::Component::Buffers, Journal::Context::BufferProcessing,
409 "Uploaded {} bytes of double-precision audio to GPU", data_bytes);
410}
#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: