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

247{
248 auto buf = std::make_shared<VKBuffer>(
249 size,
250 VKBuffer::Usage::STAGING,
251 Kakshya::DataModality::IMAGE_COLOR);
252
253 auto buffer_service = Registry::BackendRegistry::instance()
254 .get_service<Registry::Service::BufferService>();
255
256 if (!buffer_service) {
257 error<std::runtime_error>(
258 Journal::Component::Buffers,
259 Journal::Context::BufferProcessing,
260 std::source_location::current(),
261 "create_image_staging_buffer requires a valid buffer service");
262 }
263
264 buffer_service->initialize_buffer(buf);
265
266 MF_DEBUG(Journal::Component::Buffers, Journal::Context::BufferProcessing,
267 "create_image_staging_buffer: allocated {} bytes", size);
268
269 return buf;
270}
#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(), MF_DEBUG, and MayaFlux::Buffers::VKBuffer::STAGING.

Referenced by MayaFlux::Buffers::TextureProcessor::update_pixels_if_dirty().

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