MayaFlux 0.2.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 423 of file ImageReader.cpp.

424{
425 if (!m_is_open || !m_image_data) {
426 m_last_error = "No image open";
427 return false;
428 }
429
430 if (!buffer || !buffer->is_initialized()) {
431 m_last_error = "Invalid or uninitialized buffer";
432 return false;
433 }
434
435 size_t required_size = m_image_data->pixels.size();
436 if (buffer->get_size_bytes() < required_size) {
437 m_last_error = "Buffer too small for image data";
438 return false;
439 }
440
442 m_image_data->pixels.data(),
443 required_size,
444 buffer);
445
447 "Loaded image into VKBuffer: {}x{} ({} bytes)",
448 m_image_data->width, m_image_data->height, required_size);
449
450 return true;
451}
#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: