Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::geode::GeodeBufferPool Class Reference

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

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

Public Member Functions

ScopedWgpuHandle< wgpu::Buffer > acquire (wgpu::BufferUsage usage, const char *label, uint64_t minCapacity, uint64_t *outCapacity)
 Acquire a pooled buffer with exactly usage and capacity >= minCapacity.
void release (ScopedWgpuHandle< wgpu::Buffer > buffer, wgpu::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 wgpu buffers.

Owned by RendererGeode::Impl (mirrors the M4.2 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()

ScopedWgpuHandle< wgpu::Buffer > donner::geode::GeodeBufferPool::acquire ( wgpu::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 ( ScopedWgpuHandle< wgpu::Buffer > buffer,
wgpu::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: