Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodeBufferPool Class Reference

Size-and-usage-keyed free list of GPU buffers. More...

#include "donner/svg/renderer/geode/GeodeBufferPool.h"

Public Member Functions

gpu::Buffer acquire (gpu::BufferUsage usage, const char *label, uint64_t minCapacity, uint64_t *outCapacity)
 Acquire a pooled buffer with exactly usage and capacity >= minCapacity.
void release (gpu::Buffer buffer, gpu::BufferUsage usage, const char *label, uint64_t capacity)
 Return a buffer to the pool.
size_t size () const
 Number of pooled buffers (for tests).
void clear ()
 Drop every pooled buffer.

Detailed Description

Size-and-usage-keyed free list of GPU buffers.

Owned by RendererGeode::Impl (mirrors the transient render-target texture pool) and handed to every GeoEncoder the renderer constructs. Not thread-safe; all use is on the renderer's thread.

Member Function Documentation

◆ acquire()

gpu::Buffer donner::geode::GeodeBufferPool::acquire ( gpu::BufferUsage usage,
const char * label,
uint64_t minCapacity,
uint64_t * outCapacity )
inline

Acquire a pooled buffer with exactly usage and capacity >= minCapacity.

Preference order: an entry released under the same label (each arena reacquires its own previous, right-sized buffer, so a Slug curve arena never trades buffers with a tiny grid arena of the same usage class), else the smallest usage-compatible entry.

Parameters
usageRequired buffer usage flags (exact match).
labelArena debug label (string literal; matched by content).
minCapacityMinimum byte capacity.
outCapacitySet to the returned buffer's capacity on success.
Returns
The buffer, or an empty handle if the pool has no match.

◆ release()

void donner::geode::GeodeBufferPool::release ( gpu::Buffer buffer,
gpu::BufferUsage usage,
const char * label,
uint64_t capacity )
inline

Return a buffer to the pool.

When the pool is full, the smallest entry (including the incoming buffer) is dropped instead, bounding pooled VRAM while keeping the large arenas that are expensive to re-grow.


The documentation for this class was generated from the following file: