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

◆ topology_runs()

std::vector< DrawRun > MayaFlux::Nodes::Network::TopologyOperator::topology_runs ( ) const
overridevirtual

Coalesces adjacent topology graphs sharing a concatenable topology into one run.

Strip and fan graphs are always reported separately.

Reimplemented from MayaFlux::Nodes::Network::GraphicsOperator.

Definition at line 214 of file TopologyOperator.cpp.

215{
216 std::vector<DrawRun> runs;
217 uint32_t offset = 0;
218
219 for (const auto& tp : m_topologies) {
220 const auto count = static_cast<uint32_t>(tp->get_vertex_count());
221 const auto topo = tp->get_primitive_topology();
222
223 if (!runs.empty() && runs.back().topology == topo && is_concatenable_topology(topo)) {
224 runs.back().vertex_count += count;
225 } else {
226 runs.push_back(DrawRun { .topology = topo, .vertex_offset = offset, .vertex_count = count });
227 }
228
229 offset += count;
230 }
231
232 return runs;
233}
size_t count
float offset
std::vector< std::shared_ptr< GpuSync::TopologyGeneratorNode > > m_topologies
Portal::Graphics::DrawRun DrawRun
constexpr bool is_concatenable_topology(PrimitiveTopology topology) noexcept
Whether two adjacent spans of this topology can be concatenated without altering the primitives they ...

References count, m_topologies, offset, and MayaFlux::Portal::Graphics::DrawRun::topology.