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

◆ download_image()

MAYAFLUX_API std::optional< ImageData > MayaFlux::IO::download_image ( const std::shared_ptr< Core::VKImage > &  image)

Download pixel data from a GPU-resident VKImage into host ImageData.

Performs a blocking GPU->host transfer via TextureLoom::download_data, allocating a host buffer of the appropriate variant for the image format. The source image is restored to eShaderReadOnlyOptimal / eFragmentShader after the copy; pass a different restore layout/stage via the overload if the image was, for example, in a compute write state.

Multi-layer and multi-mip images are downloaded at layer 0, mip 0 only. Array and mipmap export is a separate concern.

Parameters
imageFully-initialized VKImage to read from.
Returns
Populated ImageData, or std::nullopt on failure.

Definition at line 18 of file ImageExport.cpp.

20{
21 if (!image) {
22 MF_ERROR(Journal::Component::IO, Journal::Context::FileIO,
23 "download_image: null image");
24 return std::nullopt;
25 }
26
27 return Portal::Graphics::TextureLoom::instance().download_image(image);
28}
#define MF_ERROR(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:47

References MayaFlux::Portal::Graphics::TextureLoom::download_image(), MayaFlux::Journal::FileIO, image, MayaFlux::Portal::Graphics::TextureLoom::instance(), MayaFlux::Journal::IO, and MF_ERROR.

Referenced by download_texture_buffer(), save_image(), and MayaFlux::IO::IOManager::save_image().

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