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

◆ submit_layer() [1/3]

bool MayaFlux::Buffers::TextureArrayBuffer::submit_layer ( uint32_t  layer,
const Kakshya::ImageData &  image 
)

Replace the frame of one layer with an image.

An image of the layer's extent and format is stored as raw pixels. Any other is uploaded and fitted, or dropped when set_fit chose nullopt.

Returns
True if the frame was stored.

Definition at line 94 of file TextureArrayBuffer.cpp.

95{
96 if (layer >= m_layers || image.byte_size() == 0 || !image.is_consistent()) {
98 "TextureArrayBuffer::submit_layer needs a layer below {} and a consistent image, got layer {}",
99 m_layers, layer);
100 return false;
101 }
102
103 const bool same_extent = image.width == get_width() && image.height == get_height();
104 if (same_extent && image.format == get_format()) {
105 return submit_layer(layer,
106 std::span<const uint8_t>(static_cast<const uint8_t*>(image.data()), image.byte_size()));
107 }
108
109 if (!same_extent && !fit_for(layer)) {
110 return false;
111 }
112
113 if (!m_source_staging || m_source_staging->get_size() < image.byte_size()) {
115 }
116
117 const Portal::Graphics::ImageKey key {
118 .width = image.width,
119 .height = image.height,
120 .format = image.format
121 };
122
124 m_source_cache, key,
125 std::span<const uint8_t>(static_cast<const uint8_t*>(image.data()), image.byte_size()),
127 if (!source) {
129 "TextureArrayBuffer::submit_layer failed to upload a {}x{} image", image.width, image.height);
130 return false;
131 }
132
133 return submit_layer(layer, source);
134}
#define MF_RT_ERROR(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:47
std::optional< Portal::Graphics::FitMode > fit_for(uint32_t layer) const
std::shared_ptr< VKBuffer > m_source_staging
bool submit_layer(uint32_t layer, std::span< const uint8_t > pixels)
Replace the frame of one layer with raw pixels.
Portal::Graphics::ImageCacheEntry m_source_cache
Portal::Graphics::ImageFormat get_format() const
std::shared_ptr< Core::VKImage > refresh_cached_image(ImageCacheEntry &entry, const ImageKey &key, std::span< const uint8_t > pixels, const std::shared_ptr< Buffers::VKBuffer > &staging={})
Refresh a sampled image in an owner-held cache entry.
std::shared_ptr< VKBuffer > create_image_staging_buffer(size_t size)
Allocate a persistent host-visible staging buffer sized for repeated streaming uploads to an image of...
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
Source source()
Begin a Source chain.
Definition Plot.hpp:127
MAYAFLUX_API TextureLoom & get_texture_manager()
Get the global texture manager instance.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_image_staging_buffer(), fit_for(), MayaFlux::Buffers::TextureBuffer::get_format(), MayaFlux::Buffers::TextureBuffer::get_height(), MayaFlux::Portal::Graphics::get_texture_manager(), MayaFlux::Buffers::TextureBuffer::get_width(), image, m_layers, m_source_cache, m_source_staging, MF_RT_ERROR, MayaFlux::Portal::Graphics::TextureLoom::refresh_cached_image(), submit_layer(), and MayaFlux::Portal::Graphics::ImageKey::width.

+ Here is the call graph for this function: