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

◆ append()

bool MayaFlux::Kakshya::TextureCollection::append ( const std::shared_ptr< Core::VKImage > &  image)

Copy image into the next layer.

An image of another size is scaled to fit inside the layer, keeping its aspect ratio, centred on a zeroed background. The format is converted.

Returns
True when the image was stored. False for a null image, when the device cannot blit its format into the collection's, or when a linear collection is full.

Definition at line 49 of file TextureCollection.cpp.

50{
51 if (!image || !image->is_initialized()) {
53 "TextureCollection::append called with an uninitialised image");
54 return false;
55 }
56
57 if (is_full()) {
58 if (!m_full_reported) {
60 "TextureCollection is full at {} layers ({} byte cap)", get_layer_count(), m_spec.max_bytes);
61 m_full_reported = true;
62 }
63 return false;
64 }
65
66 const bool reuse = m_spec.ring_layers > 0 && m_write_head >= m_spec.ring_layers;
67 const auto slot = reuse
68 ? static_cast<uint32_t>(m_write_head % m_spec.ring_layers)
70
71 auto target = reuse
72 ? layer_image(slot)
73 : TextureLoom::instance().create_2d(get_width(), get_height(), get_format());
74
75 if (!target || !copy_into(image, target))
76 return false;
77
78 if (reuse) {
79 hold_layer(slot);
80 } else {
81 append_image_layer(std::move(target));
82 }
83
85 return true;
86}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:47
vk::Instance instance
Definition VKDevice.cpp:39
bool is_full() const
True when a linear collection cannot take another layer.
bool copy_into(const std::shared_ptr< Core::VKImage > &image, const std::shared_ptr< Core::VKImage > &target)
void hold_layer(uint32_t layer)
Mark layer as held on the GPU after its image was rewritten.
uint32_t append_image_layer(std::shared_ptr< Core::VKImage > image)
Append one layer held on the GPU by image.
std::shared_ptr< Core::VKImage > layer_image(uint32_t layer) const
The GPU image backing layer, without uploading CPU pixels.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MayaFlux::Kakshya::TextureContainer::append_image_layer(), MayaFlux::Journal::ContainerProcessing, copy_into(), MayaFlux::Portal::Graphics::TextureLoom::create_2d(), MayaFlux::Kakshya::TextureContainer::get_format(), MayaFlux::Kakshya::TextureContainer::get_height(), MayaFlux::Kakshya::TextureContainer::get_layer_count(), MayaFlux::Kakshya::TextureContainer::get_width(), MayaFlux::Kakshya::TextureContainer::hold_layer(), image, MayaFlux::Portal::Graphics::TextureLoom::instance(), is_full(), MayaFlux::Journal::Kakshya, MayaFlux::Kakshya::TextureContainer::layer_image(), m_full_reported, m_spec, m_write_head, MayaFlux::Kakshya::TextureCollectionSpec::max_bytes, MF_ERROR, MF_WARN, and MayaFlux::Kakshya::TextureCollectionSpec::ring_layers.

+ Here is the call graph for this function: