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
GeodeBufferPool.h File Reference

Frame-transient wgpu buffer pool for GeoEncoder arenas (design doc 0030). More...

#include <cstdint>
#include <cstring>
#include <vector>
#include "donner/svg/renderer/geode/GeodeWgpuUtil.h"
Include dependency graph for GeodeBufferPool.h:

Classes

class  donner::geode::GeodeBufferPool
 Size-and-usage-keyed free list of wgpu buffers. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Detailed Description

Frame-transient wgpu buffer pool for GeoEncoder arenas (design doc 0030).

GeoEncoder instances are recreated every frame (and per layer / filter / mask push), so without pooling every frame re-creates its bump-arena buffers from scratch: 9-20 createBuffer driver allocations per steady-state frame, plus the matching releases. This pool lets a frame's encoders reuse the buffers grown by earlier frames, driving steady-state bufferCreates toward zero.

Safety: buffers are released into the pool by ~GeoEncoder, which by the renderer's existing lifetime discipline only runs after the commands referencing those buffers have been submitted (shared-mode encoders are parked in frameFinishedEncoders until the frame's single queue.submit; own-CommandEncoder encoders submit in finish()). Re-acquiring a pooled buffer on a later frame is safe: queue.writeBuffer is queue-ordered after previously submitted work.