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

◆ topology_runs()

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

Coalesces adjacent paths sharing a concatenable topology into one run.

Strip and fan paths are always reported separately.

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

Definition at line 249 of file PathOperator.cpp.

250{
251 std::vector<DrawRun> runs;
252 uint32_t offset = 0;
253
254 for (const auto& path : m_paths) {
255 const auto count = static_cast<uint32_t>(path->get_vertex_count());
256 const auto topo = path->get_primitive_topology();
257
258 if (!runs.empty() && runs.back().topology == topo && is_concatenable_topology(topo)) {
259 runs.back().vertex_count += count;
260 } else {
261 runs.push_back(DrawRun { .topology = topo, .vertex_offset = offset, .vertex_count = count });
262 }
263
264 offset += count;
265 }
266
267 return runs;
268}
size_t count
float offset
std::vector< std::shared_ptr< GpuSync::PathGeneratorNode > > m_paths
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_paths, offset, and MayaFlux::Portal::Graphics::DrawRun::topology.