MayaFlux 0.4.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 stores it statically. Subsequent calls return the same result regardless of the supplied surface and cursor; the original window remains the render target. To display on a different surface, the process must be restarted.

Definition at line 253 of file BufferQuery.cpp.

257{
258 if (s_buffer_result) {
259 return *s_buffer_result;
260 }
261
262 const auto tokens = m_bm.get_active_tokens();
263 const uint32_t in_count = m_bm.get_num_input_channels();
264 const std::string header_label = "BufferManager";
265 auto& bm = m_bm;
266 std::vector<ValueSpec> values {
267 ValueSpec {
268 .label = "tokens",
269 .reader = [&bm] { return std::to_string(bm.get_active_tokens().size()); },
270 },
271 ValueSpec {
272 .label = "inputs",
273 .reader = [&bm] { return std::to_string(bm.get_num_input_channels()); },
274 },
275 };
276
277 const auto dims = row_pixel_dims(surface.window(), x_min, x_max, row_h);
278 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
279 std::vector<RowBuffer> rbufs;
280 rbufs.reserve(values.size());
281 for (const auto& spec : values)
282 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
283
284 auto group = make_value_group(values, std::move(hbuf), rbufs,
285 surface, cursor, x_min, x_max, row_h, false);
286
287 InspectResult& result = s_buffer_result.emplace();
288 result.group = std::move(group);
289
290 for (const auto tok : tokens) {
293 InspectResult tok_result = is_audio
294 ? root_audio_buffer(tok, surface, cursor, x_min, x_max, row_h, 1)
295 : root_graphics_buffer(tok, surface, cursor, x_min, x_max, row_h, 1);
296 surface.layer().relate(result.group.header.header_id, tok_result.group.header.header_id);
297 result.children.push_back(std::move(tok_result));
298 }
299
300 if (in_count > 0) {
301 const std::string in_label = "inputs [" + std::to_string(in_count) + "]";
302 const auto in_dims = row_pixel_dims(surface.window(), x_min + k_inspect_indent, x_max, row_h);
303 auto in_hbuf = make_row_buffer(surface.window(), in_label, in_dims);
304 auto in_group = make_value_group({}, std::move(in_hbuf), {},
305 surface, cursor, x_min + k_inspect_indent, x_max, row_h, false);
306
307 InspectResult in_result;
308 in_result.group = std::move(in_group);
309 surface.layer().relate(result.group.header.header_id, in_result.group.header.header_id);
310
311 for (uint32_t ch = 0; ch < in_count; ++ch) {
312 auto buf = m_bm.get_input_buffer(ch);
313 auto buf_result = buffer(
314 std::dynamic_pointer_cast<Buffers::Buffer>(buf), surface, cursor,
315 x_min, x_max, row_h, 2);
316 surface.layer().relate(in_result.group.header.header_id, buf_result.group.header.header_id);
317 in_result.children.push_back(std::move(buf_result));
318 }
319
320 result.children.push_back(std::move(in_result));
321 }
322
323 return result;
324}
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.
static std::optional< InspectResult > s_buffer_result
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
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.
InspectResult buffer(const std::shared_ptr< Buffers::Buffer > &buf, Surface &surface, LayoutCursor &cursor, float x_min=-0.95F, float x_max=0.95F, float row_h=0.05F, int depth=0)
Inspect a single Buffer: default processor and full processing chain.
Buffers::BufferManager & m_bm
@ AUDIO_BACKEND
Standard audio processing backend configuration.
@ AUDIO_PARALLEL
High-performance audio processing with GPU acceleration.
ValueGroup make_value_group(std::span< const ValueSpec > values, RowBuffer header_buf, std::span< const RowBuffer > 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 value rows under it.
constexpr float k_inspect_indent
glm::uvec2 row_pixel_dims(const std::shared_ptr< Core::Window > &window, float x_min, float x_max, float row_h)
Convert an NDC row rect into integer pixel dimensions.
bool is_audio(const fs::path &filepath)
Definition Depot.cpp:113
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::ValueGroup::header, MayaFlux::Portal::Forma::Collapsible::header_id, MayaFlux::is_audio(), MayaFlux::Portal::Forma::k_inspect_indent, MayaFlux::Portal::Forma::ValueSpec::label, MayaFlux::Portal::Forma::Surface::layer(), m_bm, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::Layer::relate(), root_audio_buffer(), root_graphics_buffer(), MayaFlux::Portal::Forma::row_pixel_dims(), s_buffer_result, and MayaFlux::Portal::Forma::Surface::window().

+ Here is the call graph for this function: