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

◆ calculate_buffer_size()

size_t MayaFlux::Buffers::GeometryBuffer::calculate_buffer_size ( const std::shared_ptr< Nodes::GpuSync::GeometryWriterNode > &  node,
float  over_allocate_factor 
)
staticprivate

Calculate initial buffer size with optional over-allocation.

Definition at line 131 of file GeometryBuffer.cpp.

134{
135 if (!node) {
136 return 0;
137 }
138
139 size_t base_size = node->get_vertex_buffer_size_bytes();
140
141 if (base_size == 0) {
143 "GeometryWriterNode has zero-size vertex buffer. "
144 "Did you forget to call set_vertex_stride() or resize_vertex_buffer()?");
145 return 4096;
146 }
147
148 auto allocated_size = static_cast<size_t>(
149 static_cast<float>(base_size) * over_allocate_factor);
150
151 if (over_allocate_factor > 1.0F) {
153 "Over-allocated geometry buffer: {} → {} bytes ({}x)",
154 base_size, allocated_size, over_allocate_factor);
155 }
156
157 return allocated_size;
158}
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferManagement, MayaFlux::Journal::Buffers, MF_DEBUG, and MF_WARN.