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

◆ append_image_layer()

uint32_t MayaFlux::Kakshya::TextureContainer::append_image_layer ( std::shared_ptr< Core::VKImage >  image)
protected

Append one layer held on the GPU by image.

The layer has no CPU pixels until a CPU accessor reads it, which downloads image once. Writing CPU pixels replaces the content. image must be a single layer sampled 2D image with this container's width, height and format. Not safe while another thread reads or writes the container.

Returns
Index of the new layer.

Definition at line 108 of file TextureContainer.cpp.

109{
110 const auto layer = static_cast<uint32_t>(m_data.size());
111
112 m_data.emplace_back(make_empty_storage(m_format, 0));
114 m_normalised_cache.emplace_back();
115 m_normalised_dirty = extended(m_normalised_dirty, true);
116 m_cpu_stale = extended(m_cpu_stale, true);
117
118 {
119 Memory::SerializedSeqlockWriteGuard image_guard(m_image_cache_lock);
120 m_layer_image_cache.push_back({
121 .key = { .width = m_width, .height = m_height, .layers = 1, .format = m_format },
122 .image = std::move(image),
123 });
124 }
125
128 return layer;
129}
IO::ImageData image
Definition Decoder.cpp:47
std::vector< std::atomic< bool > > m_normalised_dirty
std::vector< std::atomic< bool > > m_cpu_stale
Per layer: the GPU image in m_layer_image_cache holds the content, m_data does not.
void update_processing_state(ProcessingState state) override
Update the processing state of the container.
std::vector< Portal::Graphics::ImageCacheEntry > m_layer_image_cache
std::vector< std::vector< float > > m_normalised_cache
void extend(size_t n)
Add n default-constructed Seqlock instances after the existing slots.
Definition SeqLock.hpp:356
@ READY
Container has data loaded and is ready for processing.
DataVariant make_empty_storage(ImageFormat format, size_t element_count)
Allocate a zeroed DataVariant of the alternative backing a format.

References MayaFlux::Memory::SeqlockArray::extend(), image, m_cpu_stale, m_data, m_format, m_height, m_image_cache_lock, m_layer_image_cache, m_normalised_cache, m_normalised_dirty, m_slot_locks, m_width, MayaFlux::Kakshya::make_empty_storage(), MayaFlux::Kakshya::READY, setup_dimensions(), and update_processing_state().

Referenced by MayaFlux::Kakshya::TextureCollection::append().

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