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

◆ buffer_manager()

InspectResult & MayaFlux::Portal::Forma::Inspector::buffer_manager ( Surface &  surface,
LayoutCursor &  cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F 
)

Inspect the full BufferManager state across all active tokens.

Emits one top-level collapsible per active Buffers::ProcessingToken. Audio tokens (AUDIO_BACKEND, AUDIO_PARALLEL) expand per-channel rows showing sample count, child buffer count, and processing chain state. Graphics tokens (GRAPHICS_BACKEND) expand a single root entry showing VKBuffer child count. All children are related via layer.relate() for cascade.

Persistent: the first call builds the result against surface and cursor and keeps it on this Inspector. Subsequent calls return the same result regardless of the supplied surface and cursor; the original window remains the render target. destroy() releases it, and the next call builds afresh.

Definition at line 245 of file BufferQuery.cpp.

249{
250 if (m_buffer_result) {
251 return *m_buffer_result;
252 }
253
254 const auto tokens = m_bm.get_active_tokens();
255 const uint32_t in_count = m_bm.get_num_input_channels();
256 const std::string header_label = "BufferManager";
257 auto& bm = m_bm;
258 std::vector<EntrySpec> entrys {
259 EntrySpec {
260 .label = "tokens",
261 .reader = [&bm] { return std::to_string(bm.get_active_tokens().size()); },
262 },
263 EntrySpec {
264 .label = "inputs",
265 .reader = [&bm] { return std::to_string(bm.get_num_input_channels()); },
266 },
267 };
268
269 auto hbuf = make_header_buffer(surface.window());
270 auto rbufs = make_row_buffers(surface.window(), entrys.size());
271
272 auto group = make_entry_group(entrys, header_label, std::move(hbuf), rbufs,
273 surface, cursor, x_min, x_max, row_h, false);
274
275 InspectResult& result = m_buffer_result.emplace();
276 result.group = std::move(group);
277
278 for (const auto tok : tokens) {
281 InspectResult tok_result = is_audio
282 ? root_audio_buffer(tok, surface, cursor, x_min, x_max, row_h, 1)
283 : root_graphics_buffer(tok, surface, cursor, x_min, x_max, row_h, 1);
284 surface.layer().relate(result.group.header.header_id, tok_result.group.header.header_id);
285 result.children.push_back(std::move(tok_result));
286 }
287
288 if (in_count > 0) {
289 const std::string in_label = "inputs [" + std::to_string(in_count) + "]";
290 auto in_hbuf = make_header_buffer(surface.window());
291 auto in_group = make_entry_group({}, in_label, std::move(in_hbuf), {},
292 surface, cursor, x_min + k_inspect_indent, x_max, row_h, false);
293
294 InspectResult in_result;
295 in_result.group = std::move(in_group);
296 surface.layer().relate(result.group.header.header_id, in_result.group.header.header_id);
297
298 for (uint32_t ch = 0; ch < in_count; ++ch) {
299 auto buf = m_bm.get_input_buffer(ch);
300 auto buf_result = buffer(
301 std::dynamic_pointer_cast<Buffers::Buffer>(buf), surface, cursor,
302 x_min, x_max, row_h, 2);
303 surface.layer().relate(in_result.group.header.header_id, buf_result.group.header.header_id);
304 in_result.children.push_back(std::move(buf_result));
305 }
306
307 result.children.push_back(std::move(in_result));
308 }
309
310 return result;
311}
std::shared_ptr< NetworkGeometryBuffer > buffer
std::shared_ptr< Buffers::InputAudioBuffer > get_input_buffer(uint32_t channel) const
std::vector< ProcessingToken > get_active_tokens() const
Gets all currently active processing tokens.
std::shared_ptr< Buffers::FormaBuffer > make_header_buffer(const std::shared_ptr< Core::Window > &window) const
A "text"-slotted buffer, registered with the BufferManager.
Definition Inspector.cpp:11
std::vector< EntryBuffer > make_row_buffers(const std::shared_ptr< Core::Window > &window, size_t count) const
count row targets, slices of one "text"-slotted buffer, for make_entry_group's rows.
Definition Inspector.cpp:24
InspectResult root_audio_buffer(Buffers::ProcessingToken token, uint32_t channel, Surface &surface, LayoutCursor &cursor, float x_min=-0.95F, float x_max=0.95F, float row_h=0.05F, int depth=0)
Inspect the root audio buffer for a specific token and channel.
InspectResult root_graphics_buffer(Buffers::ProcessingToken token, Surface &surface, LayoutCursor &cursor, float x_min=-0.95F, float x_max=0.95F, float row_h=0.05F, int depth=0)
Inspect the root graphics buffer for a token.
Buffers::BufferManager & m_bm
std::optional< InspectResult > m_buffer_result
@ AUDIO_BACKEND
Standard audio processing backend configuration.
@ AUDIO_PARALLEL
High-performance audio processing with GPU acceleration.
EntryGroup make_entry_group(std::span< const EntrySpec > entrys, std::string_view header_label, FormaTarget header_buf, std::span< const EntryBuffer > row_bufs, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, bool initially_open)
Construct a collapsible header followed by N entry rows under it.
Definition Entry.cpp:104
constexpr float k_inspect_indent
bool is_audio(const fs::path &filepath)
Definition Depot.cpp:141
std::vector< InspectResult > children

References MayaFlux::Buffers::AUDIO_BACKEND, MayaFlux::Buffers::AUDIO_PARALLEL, buffer, MayaFlux::Portal::Forma::InspectResult::children, MayaFlux::Buffers::BufferManager::get_active_tokens(), MayaFlux::Buffers::BufferManager::get_input_buffer(), MayaFlux::Buffers::BufferManager::get_num_input_channels(), MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::EntryGroup::header, MayaFlux::Portal::Forma::Collapsible::header_id, MayaFlux::is_audio(), MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::EntrySpec::label, MayaFlux::Portal::Forma::Surface::layer(), m_bm, m_buffer_result, MayaFlux::Portal::Forma::make_entry_group(), make_header_buffer(), make_row_buffers(), MayaFlux::Portal::Forma::Layer::relate(), root_audio_buffer(), root_graphics_buffer(), and MayaFlux::Portal::Forma::Surface::window().

Referenced by MayaFlux::Portal::Forma::inspect_buffers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: