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

◆ to_image()

std::shared_ptr< Core::VKImage > MayaFlux::Kakshya::TextureContainer::to_image ( uint32_t  layer = 0) const

Upload the pixel buffer to a new VKImage via TextureLoom.

Parameters
layerArray layer index for array textures (default 0).
Returns
Newly created and uploaded VKImage. Null on failure.

Creates a fresh 2D texture each call. Does not cache the result. The returned image is owned by TextureLoom's internal registry.

Definition at line 272 of file TextureContainer.cpp.

273{
274 std::shared_lock lock(m_data_mutex);
275
276 if (layer >= m_data.size()) {
278 "TextureContainer::to_image layer {} out of range ({})", layer, m_data.size());
279 return nullptr;
280 }
281
282 auto [ptr, bytes] = variant_bytes(m_data[layer]);
283 if (!ptr || bytes == 0) {
285 "TextureContainer::to_image called on empty/invalid buffer");
286 return nullptr;
287 }
288
290 if (!img) {
292 "TextureContainer::to_image: TextureLoom failed to create VKImage");
293 }
294 return img;
295}
#define MF_ERROR(comp, ctx,...)
void lock() override
Acquire a lock for thread-safe access.
Portal::Graphics::ImageFormat m_format
std::shared_ptr< Core::VKImage > create_2d(uint32_t width, uint32_t height, ImageFormat format=ImageFormat::RGBA8, const void *data=nullptr, uint32_t mip_levels=1)
Create a 2D texture.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MF_ERROR.

Referenced by MayaFlux::Yantra::TextureExecutionContext::stage_input().

+ Here is the caller graph for this function: