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

◆ create_image_staging_buffer()

MAYAFLUX_API std::shared_ptr< VKBuffer > MayaFlux::Buffers::create_image_staging_buffer ( size_t  size)

Allocate a persistent host-visible staging buffer sized for repeated streaming uploads to an image of size bytes.

Call once; pass the result to upload_image_streaming() every frame.

Parameters
sizeByte footprint of the target image (use VKImage::get_size_bytes()).
Returns
Initialised host-visible VKBuffer, or nullptr on failure.

Definition at line 233 of file StagingUtils.cpp.

234{
235 auto buf = std::make_shared<VKBuffer>(
236 size,
237 VKBuffer::Usage::STAGING,
238 Kakshya::DataModality::IMAGE_COLOR);
239
240 auto buffer_service = Registry::BackendRegistry::instance()
241 .get_service<Registry::Service::BufferService>();
242
243 if (!buffer_service) {
244 error<std::runtime_error>(
245 Journal::Component::Buffers,
246 Journal::Context::BufferProcessing,
247 std::source_location::current(),
248 "create_image_staging_buffer requires a valid buffer service");
249 }
250
251 buffer_service->initialize_buffer(buf);
252
253 MF_DEBUG(Journal::Component::Buffers, Journal::Context::BufferProcessing,
254 "create_image_staging_buffer: allocated {} bytes", size);
255
256 return buf;
257}
#define MF_DEBUG(comp, ctx,...)
Backend buffer management service interface.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Kakshya::IMAGE_COLOR, MayaFlux::Registry::BackendRegistry::instance(), and MF_DEBUG.

Referenced by MayaFlux::Portal::Forma::make_value_row(), MayaFlux::Buffers::ImageCVProcessor< T >::on_attach(), MayaFlux::Kakshya::VisionProcessor::on_attach(), MayaFlux::Buffers::TextureProcessor::update_pixels_if_dirty(), MayaFlux::Buffers::DataWriteProcessor::upload_texture(), and MayaFlux::IO::VideoFileWriter::worker_loop().

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