MayaFlux 0.2.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 73 of file GeometryBuffer.cpp.

76{
77 if (!node) {
78 return 0;
79 }
80
81 size_t base_size = node->get_vertex_buffer_size_bytes();
82
83 if (base_size == 0) {
85 "GeometryWriterNode has zero-size vertex buffer. "
86 "Did you forget to call set_vertex_stride() or resize_vertex_buffer()?");
87 return 4096;
88 }
89
90 auto allocated_size = static_cast<size_t>(
91 static_cast<float>(base_size) * over_allocate_factor);
92
93 if (over_allocate_factor > 1.0F) {
95 "Over-allocated geometry buffer: {} → {} bytes ({}x)",
96 base_size, allocated_size, over_allocate_factor);
97 }
98
99 return allocated_size;
100}
#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.