MayaFlux 0.3.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 122 of file GeometryBuffer.cpp.

125{
126 if (!node) {
127 return 0;
128 }
129
130 size_t base_size = node->get_vertex_buffer_size_bytes();
131
132 if (base_size == 0) {
134 "GeometryWriterNode has zero-size vertex buffer. "
135 "Did you forget to call set_vertex_stride() or resize_vertex_buffer()?");
136 return 4096;
137 }
138
139 auto allocated_size = static_cast<size_t>(
140 static_cast<float>(base_size) * over_allocate_factor);
141
142 if (over_allocate_factor > 1.0F) {
144 "Over-allocated geometry buffer: {} → {} bytes ({}x)",
145 base_size, allocated_size, over_allocate_factor);
146 }
147
148 return allocated_size;
149}
#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.