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

◆ ensure_staging()

void MayaFlux::Buffers::NetworkGeometryProcessor::ensure_staging ( NetworkBinding binding,
size_t  bytes 
)
private

Grow a binding's staging buffer to hold at least bytes.

The target vertex buffer resizes with 1.5x headroom when a network grows, so the staging buffer it was sized against goes stale. Growing by the same factor keeps reallocation proportional to growth rather than per frame.

Parameters
bindingBinding whose staging_buffer is checked and possibly replaced.
bytesRequired capacity.

Definition at line 269 of file NetworkGeometryProcessor.cpp.

270{
271 if (!binding.gpu_vertex_buffer || binding.gpu_vertex_buffer->is_host_visible())
272 return;
273
274 if (binding.staging_buffer && binding.staging_buffer->get_size_bytes() >= bytes)
275 return;
276
277 const auto grown = static_cast<size_t>(static_cast<float>(bytes) * 1.5F);
278 binding.staging_buffer = create_staging_buffer(grown);
279
281 "NetworkGeometryProcessor: staging buffer grown to {} bytes", grown);
282}
#define MF_DEBUG(comp, ctx,...)
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_staging_buffer(), MayaFlux::Buffers::NetworkGeometryProcessor::NetworkBinding::gpu_vertex_buffer, MF_DEBUG, and MayaFlux::Buffers::NetworkGeometryProcessor::NetworkBinding::staging_buffer.

Referenced by processing_function(), and try_incremental_upload().

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