Upload m_data[frame_index] to a new VKImage.
248{
249 if (frame_index >=
m_data.size()) {
251 "WindowContainer::to_image({}) : out of range (capacity={})",
253 return nullptr;
254 }
255
257 const uint32_t head =
m_write_head.load(std::memory_order_acquire);
259
260 if (!ring_full && frame_index >= head) {
262 "WindowContainer::image_at({}) : frame index is ahead of write head ({}), data may be stale or uninitialized",
263 frame_index, head);
264 return nullptr;
265 }
266
267 std::shared_ptr<Core::VKImage> img;
268
270 const auto*
pixels = std::get_if<std::vector<uint8_t>>(&
m_data[frame_index]);
273 "WindowContainer::image_at({}) : slot is empty", frame_index);
274 return;
275 }
276
280
281 if (!img) {
283 "WindowContainer::image_at({}) : TextureLoom::create_2d failed", frame_index);
284 }
285 });
286 return img;
287}
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
const std::vector< float > * pixels
std::shared_ptr< Core::Window > m_window
std::atomic< uint32_t > m_write_head
Memory::Seqlock m_data_lock
ContainerDataStructure m_structure
std::vector< DataVariant > m_data
std::atomic< uint64_t > m_frames_written
uint32_t m_frame_capacity
static TextureLoom & instance()
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.
Core::GraphicsSurfaceInfo::SurfaceFormat query_surface_format(const std::shared_ptr< Core::Window > &window)
Query the actual vk::Format in use by the window's live swapchain, translated back to the MayaFlux su...
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.
static uint64_t get_height(const std::vector< DataDimension > &dimensions)
Extract height from image/video dimensions.
static uint64_t get_width(const std::vector< DataDimension > &dimensions)
Extract width from image/video dimensions.