Execute a full-surface pixel readback.
Allocates a format-appropriate DataVariant and updates container ProcessingState: PROCESSING → PROCESSED.
74{
75 auto wc = std::dynamic_pointer_cast<WindowContainer>(container);
76 if (!wc) {
78 "WindowAccessProcessor::process — container is not a WindowContainer");
79 return;
80 }
81
82 const auto& window = wc->get_window();
83
86 "WindowAccessProcessor: no completed frame available for '{}'",
87 window->get_create_info().title);
88 return;
89 }
90
95
97
99 "WindowAccessProcessor: '{}' resized to {}x{} format={}",
102 }
103
106
107 auto& processed = container->get_processed_data();
108 processed.resize(1);
109
111
112 const bool has_data = std::visit(
113 [](const auto& v) { return !v.empty(); }, processed[0]);
114
115 if (!has_data) {
117 "WindowAccessProcessor: readback returned no data for '{}'",
118 window->get_create_info().title);
121 return;
122 }
123
124 const auto* src = std::get_if<std::vector<uint8_t>>(&processed[0]);
125 if (src) {
126 if (uint8_t* dst = wc->mutable_frame_ptr(wc->get_write_head())) {
127 std::memcpy(dst, src->data(), src->size());
128 wc->advance_write_head();
129 }
130 }
131
135
138}
#define MF_INFO(comp, ctx,...)
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_RT_TRACE(comp, ctx,...)
size_t m_last_readback_bytes
Core::GraphicsSurfaceInfo::SurfaceFormat m_surface_format
std::atomic< bool > m_is_processing
vk::Format to_vk_format(GraphicsSurfaceInfo::SurfaceFormat fmt)
uint32_t vk_format_bytes_per_pixel(vk::Format fmt)
Byte width of a single pixel for a given Vulkan format.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ ERROR
Container is in an error state and cannot proceed.
@ PROCESSING
Container is actively being processed.
@ PROCESSED
Container has completed processing and results are available.
bool is_readback_available(const std::shared_ptr< Core::Window > &window)
Check whether a completed frame is currently available for readback.
std::pair< uint32_t, uint32_t > query_surface_extent(const std::shared_ptr< Core::Window > &window)
Query the current pixel dimensions of the window's swapchain.
DataAccess readback_region(const std::shared_ptr< Core::Window > &window, uint32_t x_offset, uint32_t y_offset, uint32_t pixel_width, uint32_t pixel_height, DataVariant &out_variant)
Read a pixel rectangle from the last completed swapchain frame into a DataVariant whose element type ...
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...