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

Per-entity GPU residence for Geode's cached encoded-path geometry (design doc 0030 wave 2: "GPU residence"). More...

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

Classes

struct  donner::geode::GeodeResidentSlot
 GPU-resident geometry for one cached EncodedPath (a fill slot or a stroke slot). Owns a single combined-usage GPU buffer that holds the path's vertex quad, the six analytic dual-ray SSBO regions, and the per-draw uniform block, plus the cached fill bind group. The buffer and bind group are built once by GeoEncoder on first residence and reused every subsequent unchanged frame. More...
struct  donner::geode::GeodeResidentSlot::Region
 A byte sub-range of buffer. size == 0 is never bound directly - empty SSBO regions reserve a 4-byte zero-filled slot so the shader's band-count gate keeps them un-dereferenced (matching the wave-1 arena allocStorageOrDummy dummy). More...
struct  donner::geode::GeodeResidentPathComponent
 Sibling of GeodePathCacheComponent: holds the GPU residence for an entity's fill and stroke encodes. Installed lazily by RendererGeode at the solid-fill draw sites; removed by the same entt listener that clears GeodePathCacheComponent when geometry changes. More...

Namespaces

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

Detailed Description

Per-entity GPU residence for Geode's cached encoded-path geometry (design doc 0030 wave 2: "GPU residence").

The M2 GeodePathCacheComponent keeps the CPU-side EncodedPath across frames, but wave 1 still re-uploaded that geometry to a fresh per-frame bump arena on every draw - the measured headline cost was a static Ghostscript Tiger writing ~1.44 MB per frame across 2,432 writeBuffer calls even though the CPU encode cache hit, plus one createBindGroup per draw (304/frame).

This component gives each cached path a persistent GPU buffer that survives frames, so an unchanged document's steady-state frame writes ~zero geometry bytes and re-uses a cached bind group. It lives BESIDE GeodePathCacheComponent on the same entity and is removed by the same ComputedPathComponent on_update / on_destroy listener (RendererGeode::Impl::onComputedPathChanged), so the GPU residence invalidates exactly when the geometry changes. Registry teardown (document close) destroys the component and RAII-frees the buffer - the eviction story for "many distinct documents".

Lives in donner::geode (not donner::svg::geode) to match the other Geode types referenced unqualified via geode:: inside donner::svg.


Class Documentation

◆ donner::geode::GeodeResidentSlot::Region

struct donner::geode::GeodeResidentSlot::Region

A byte sub-range of buffer. size == 0 is never bound directly - empty SSBO regions reserve a 4-byte zero-filled slot so the shader's band-count gate keeps them un-dereferenced (matching the wave-1 arena allocStorageOrDummy dummy).

Class Members
uint64_t offset = 0
uint64_t size = 0