Upload m_data[frame_index] reusing a caller-supplied staging buffer.
297{
299
300 if (frame_index >=
m_data.size()) {
302 "WindowContainer::image_at(staging, {}) : out of range (capacity={})",
304 return nullptr;
305 }
306
307 {
309 const uint32_t head =
m_write_head.load(std::memory_order_acquire);
311 const bool slot_valid = ring_full || frame_index < head;
312 if (!slot_valid) {
314 "WindowContainer::image_at(staging, {}) : frame index is ahead of write head ({}), data may be stale or uninitialized",
315 frame_index, head);
316 return nullptr;
317 }
318 }
319
320 const auto*
pixels = std::get_if<std::vector<uint8_t>>(&
m_data[frame_index]);
323 "WindowContainer::image_at(staging, {}) — slot is empty", frame_index);
324 return nullptr;
325 }
326
329
330 auto img = loom.create_2d(
332 if (!img) {
334 "WindowContainer::image_at(staging, {}) : VKImage allocation failed", frame_index);
335 return nullptr;
336 }
337
338 loom.upload_data(img,
pixels->data(),
pixels->size(), staging);
339 return img;
340}
#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
void lock() override
Acquire a lock for thread-safe access.
std::shared_mutex m_data_mutex
ContainerDataStructure m_structure
std::vector< DataVariant > m_data
std::atomic< uint64_t > m_frames_written
uint32_t m_frame_capacity
static TextureLoom & instance()
@ 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...
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.