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

◆ add()

SliceSet::SliceId MayaFlux::Buffers::SliceSet::add ( std::span< const uint8_t >  bytes,
std::optional< Portal::Graphics::PrimitiveTopology >  topology = std::nullopt 
)

Append a block at the end of memory and draw order.

Parameters
bytesWhole vertices.
topologyTopology of this block; the set's default when omitted.
Returns
Id of the block, or 0 if bytes is not a whole number of vertices.

Definition at line 22 of file SliceSet.cpp.

25{
26 if (bytes.size() % m_stride != 0) {
28 "SliceSet::add: {} bytes is not a whole number of {} byte vertices",
29 bytes.size(), m_stride);
30 return 0;
31 }
32
33 const SliceId id = m_next_id++;
34 const size_t offset = m_mirror.size();
35
36 m_mirror.insert(m_mirror.end(), bytes.begin(), bytes.end());
37 m_slices.emplace(id, Slice { .byte_offset = offset, .byte_size = bytes.size(), .topology = topology.value_or(m_topology) });
38 m_memory_order.push_back(id);
39 m_draw_order.push_back(id);
40
41 mark_dirty(offset, m_mirror.size());
42 m_runs_changed = true;
43 return id;
44}
#define MF_ERROR(comp, ctx,...)
uint64_t offset
Definition Composite.cpp:10
PrimitiveTopology topology
void mark_dirty(size_t start, size_t end)
Definition SliceSet.cpp:213
std::unordered_map< SliceId, Slice > m_slices
Definition SliceSet.hpp:114
std::vector< SliceId > m_draw_order
Definition SliceSet.hpp:116
std::vector< SliceId > m_memory_order
Definition SliceSet.hpp:115
std::vector< uint8_t > m_mirror
Definition SliceSet.hpp:117
Portal::Graphics::PrimitiveTopology m_topology
Definition SliceSet.hpp:111
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferManagement, MayaFlux::Journal::Buffers, MayaFlux::Buffers::SliceSet::Slice::byte_offset, m_draw_order, m_memory_order, m_mirror, m_next_id, m_runs_changed, m_slices, m_stride, m_topology, mark_dirty(), MF_ERROR, offset, and topology.

Referenced by MayaFlux::Buffers::FormaProcessor::add_slice(), and MayaFlux::Buffers::FormaProcessor::set_bytes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: