MayaFlux 0.5.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 161 of file GeometryBuffer.cpp.

164{
165 if (!node) {
166 return 0;
167 }
168
169 size_t base_size = node->get_vertex_buffer_size_bytes();
170
171 if (base_size == 0) {
173 "GeometryWriterNode has zero-size vertex buffer. "
174 "Did you forget to call set_vertex_stride() or resize_vertex_buffer()?");
175 return 4096;
176 }
177
178 auto allocated_size = static_cast<size_t>(
179 static_cast<float>(base_size) * over_allocate_factor);
180
181 if (over_allocate_factor > 1.0F) {
183 "Over-allocated geometry buffer: {} → {} bytes ({}x)",
184 base_size, allocated_size, over_allocate_factor);
185 }
186
187 return allocated_size;
188}
#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.