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

◆ load_into_buffer()

bool MayaFlux::IO::ImageReader::load_into_buffer ( const std::shared_ptr< Buffers::VKBuffer > &  buffer)

Load image directly into an existing VKBuffer.

Parameters
bufferTarget buffer (must be large enough)
Returns
True if load succeeded

Definition at line 467 of file ImageReader.cpp.

468{
469 if (!m_is_open || !m_image_data) {
470 m_last_error = "No image open";
471 return false;
472 }
473
474 if (!buffer || !buffer->is_initialized()) {
475 m_last_error = "Invalid or uninitialized buffer";
476 return false;
477 }
478
479 size_t required_size = m_image_data->pixels.size();
480 if (buffer->get_size_bytes() < required_size) {
481 m_last_error = "Buffer too small for image data";
482 return false;
483 }
484
486 m_image_data->pixels.data(),
487 required_size,
488 buffer);
489
491 "Loaded image into VKBuffer: {}x{} ({} bytes)",
492 m_image_data->width, m_image_data->height, required_size);
493
494 return true;
495}
#define MF_INFO(comp, ctx,...)
std::optional< ImageData > m_image_data
void upload_to_gpu(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging)
Upload raw data to GPU buffer (auto-detects host-visible vs device-local)
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, m_image_data, m_is_open, m_last_error, MF_INFO, and MayaFlux::Buffers::upload_to_gpu().

+ Here is the call graph for this function: