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

◆ take_runs()

std::optional< std::vector< Portal::Graphics::DrawRun > > MayaFlux::Buffers::SliceSet::take_runs ( )

Runs for the visible blocks in draw order, if they changed.

Returns
The new run list once after each change, then nullopt.

Definition at line 138 of file SliceSet.cpp.

139{
140 if (!m_runs_changed) {
141 return std::nullopt;
142 }
143 m_runs_changed = false;
144
145 std::vector<Portal::Graphics::DrawRun> runs;
146 for (const SliceId id : m_draw_order) {
147 const auto& slice = m_slices.at(id);
148 if (!slice.visible || slice.byte_size == 0) {
149 continue;
150 }
151
152 const auto offset = static_cast<uint32_t>(slice.byte_offset / m_stride);
153 const auto count = static_cast<uint32_t>(slice.byte_size / m_stride);
154
155 if (is_concatenable_topology(slice.topology) && !runs.empty()
156 && runs.back().topology == slice.topology
157 && runs.back().vertex_offset + runs.back().vertex_count == offset) {
158 runs.back().vertex_count += count;
159 continue;
160 }
161
162 runs.push_back({ .topology = slice.topology, .vertex_offset = offset, .vertex_count = count });
163 }
164
165 return runs;
166}
uint64_t offset
Definition Composite.cpp:10
size_t count
std::unordered_map< SliceId, Slice > m_slices
Definition SliceSet.hpp:114
std::vector< SliceId > m_draw_order
Definition SliceSet.hpp:116
std::vector< double > slice(std::span< const double > data, double start_ratio, double end_ratio)
Extract a contiguous slice by ratio, returning a new vector.
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_draw_order, m_runs_changed, m_slices, m_stride, and offset.

Referenced by MayaFlux::Buffers::FormaProcessor::processing_function().

+ Here is the caller graph for this function: