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

◆ image_at() [2/2]

std::shared_ptr< Core::VKImage > MayaFlux::Kakshya::WindowContainer::image_at ( uint32_t  frame_index,
const std::shared_ptr< Buffers::VKBuffer > &  staging 
) const

Upload m_data[frame_index] reusing a caller-supplied staging buffer.

Parameters
frame_indexIndex into m_data in [0, frame_capacity).
stagingHost-visible VKBuffer sized to at least w * h * bpp.

Definition at line 246 of file WindowContainer.cpp.

248{
249 if (frame_index >= m_data.size()) {
251 "WindowContainer::image_at(staging, {}) : out of range (capacity={})",
252 frame_index, m_frame_capacity);
253 return nullptr;
254 }
255
256 const uint64_t written = m_frames_written.load(std::memory_order_acquire);
257 const uint32_t head = m_write_head.load(std::memory_order_acquire);
258 const bool ring_full = written >= m_frame_capacity;
259 if (!ring_full && frame_index >= head) {
261 "WindowContainer::image_at(staging, {}) : frame index is ahead of write head ({}), data may be stale or uninitialized",
262 frame_index, head);
263 return nullptr;
264 }
265
266 auto pixels = snapshot_pixels(frame_index);
267 if (!pixels)
268 return nullptr;
269
270 const auto format = get_image_format();
271 Memory::SerializedSeqlockWriteGuard image_guard(m_image_cache_lock);
273 m_frame_images[frame_index], sampled_image_key(pixels->width, pixels->height, format),
274 pixels->pixels, staging);
275}
#define MF_RT_WARN(comp, ctx,...)
const std::vector< float > * pixels
Definition Decoder.cpp:48
bool format
std::optional< PixelSnapshot > snapshot_pixels(std::optional< uint32_t > frame_index=std::nullopt) const
ImageFormat get_image_format() const
Portal ImageFormat corresponding to the live swapchain surface format.
std::vector< DataVariant > m_data
std::atomic< uint64_t > m_frames_written
std::vector< Portal::Graphics::ImageCacheEntry > m_frame_images
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.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MayaFlux::Journal::ContainerProcessing, format, get_image_format(), MayaFlux::Portal::Graphics::TextureLoom::instance(), MayaFlux::Journal::Kakshya, m_data, m_frame_capacity, m_frame_images, m_frames_written, m_image_cache_lock, m_write_head, MF_RT_WARN, pixels, MayaFlux::Portal::Graphics::TextureLoom::refresh_cached_image(), and snapshot_pixels().

+ Here is the call graph for this function: