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

◆ rebuild_sort()

void MayaFlux::Nodes::Network::MeshNetwork::rebuild_sort ( )
private

Definition at line 190 of file MeshNetwork.cpp.

191{
192 // Roots: slots with no parent.
193 std::vector<uint32_t> queue;
194 for (uint32_t i = 0; i < static_cast<uint32_t>(m_slots.size()); ++i) {
195 if (!m_slots[i].parent_index.has_value())
196 queue.push_back(i);
197 }
198
199 m_sorted_indices.clear();
200 m_sorted_indices.reserve(m_slots.size());
201
202 while (!queue.empty()) {
203 uint32_t idx = queue.front();
204 queue.erase(queue.begin());
205 m_sorted_indices.push_back(idx);
206
207 for (uint32_t child : m_slots[idx].child_indices)
208 queue.push_back(child);
209 }
210
211 if (m_sorted_indices.size() != m_slots.size()) {
213 "MeshNetwork: slot DAG contains a cycle — sort is incomplete");
214 }
215
216 m_sort_dirty = false;
217
219 "MeshNetwork: rebuilt slot sort order ({} slots)", m_sorted_indices.size());
220}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
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.

References MayaFlux::Journal::Init, m_slots, m_sort_dirty, m_sorted_indices, MF_DEBUG, MF_ERROR, and MayaFlux::Journal::Nodes.

Referenced by ensure_sorted(), and process_batch().

+ Here is the caller graph for this function: