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

◆ to_image() [2/2]

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 384 of file TextureContainer.cpp.

385{
386 if (layer >= m_data.size()) {
388 "TextureContainer::to_image layer {} out of range ({})", layer, m_data.size());
389 return nullptr;
390 }
391
392 std::shared_ptr<Core::VKImage> img;
393 seqlock_read_void(m_slot_locks[layer], 8, [&] {
394 auto [ptr, bytes] = variant_bytes(m_data[layer]);
395 if (!ptr || bytes == 0)
396 return;
398 });
399
400 if (!img) {
402 "TextureContainer::to_image: TextureLoom failed to create VKImage");
403 }
404 return img;
405}
#define MF_ERROR(comp, ctx,...)
const uint8_t * ptr
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.
bool seqlock_read_void(const Seqlock &lock, uint32_t max_attempts, Fn &&fn)
Invoke a void read functor under a Seqlock with a bounded retry count.
Definition SeqLock.hpp:222

References MF_ERROR, and ptr.

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

+ Here is the caller graph for this function: