188{
189
190 std::vector<uint32_t> in_degree(
m_slots.size(), 0);
191 for (
const auto& slot :
m_slots) {
192 if (slot.parent_index.has_value())
193 ++in_degree[slot.parent_index.value()];
194 }
195
196
197 std::vector<uint32_t> queue;
198 for (uint32_t i = 0; i < static_cast<uint32_t>(
m_slots.size()); ++i) {
199 if (!
m_slots[i].parent_index.has_value())
200 queue.push_back(i);
201 }
202
205
206 while (!queue.empty()) {
207 uint32_t idx = queue.front();
208 queue.erase(queue.begin());
210
211 for (uint32_t child :
m_slots[idx].child_indices)
212 queue.push_back(child);
213 }
214
217 "MeshNetwork: slot DAG contains a cycle — sort is incomplete");
218 }
219
221
223 "MeshNetwork: rebuilt slot sort order ({} slots)",
m_sorted_indices.size());
224}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::vector< MeshSlot > m_slots
std::vector< uint32_t > m_sorted_indices
Processing order: indices into m_slots, parents before children.
bool m_sort_dirty
Set when add_slot() changes the DAG and a re-sort is needed.
@ Init
Engine/subsystem initialization.
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.