Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
GeodeGlyphResidency.h File Reference

Glyph-identity-keyed CPU encode + GPU residence for Geode text rendering. More...

#include <algorithm>
#include <cstdint>
#include <cstring>
#include <limits>
#include <memory>
#include <optional>
#include <span>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
#include "donner/base/FillRule.h"
#include "donner/base/Path.h"
#include "donner/base/Vector2.h"
#include "donner/svg/renderer/geode/GeodePathEncoder.h"
#include "donner/svg/renderer/geode/GeodePerDevice.h"
#include "donner/svg/renderer/geode/GeodeResidentPathComponent.h"
Include dependency graph for GeodeGlyphResidency.h:

Classes

struct  donner::geode::GlyphGeometryKey
 Identity of one unique glyph outline: every input that can change the encoded geometry, and nothing that cannot. More...
struct  donner::geode::GlyphGeometryKeyHash
 Hash for GlyphGeometryKey. Mixes with the 64-bit splitmix finalizer so the low-entropy fields (small glyph indices, a handful of scales) still spread across buckets. More...
struct  donner::geode::GeodeGlyphResidentEntry
 One unique glyph outline: the CPU outline, its analytic encode, and its GPU residence. More...
class  donner::geode::GeodeGlyphCache
 Document-scoped cache of unique glyph outlines and their GPU residence. More...
struct  donner::geode::GeodeTextInstanceResidencyComponent
 One text element's persistent occurrence records, one GeodeOccurrenceRecords per device that draws it: records hold slots in that device's record slab, and a device's frame generation means nothing to another device. More...
class  donner::geode::GeodeTextShapeCache
 Retained encodes and GPU residence of the shapes one text element paints outside the glyph cache's solid fills: placed glyph outlines filled with a gradient or a pattern, or with a solid along a text path; the joined stroke outlines of its glyphs; and its decoration lines and their strokes. More...
struct  donner::geode::GeodeTextShapeCache::Shape
 One retained shape: its geometry key, encode and residence. More...
struct  donner::geode::GeodeTextShapeResidencyComponent
 One text element's retained shapes, one GeodeTextShapeCache per device that draws it: the shapes' residence lives in that device's slab. More...

Namespaces

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

Detailed Description

Glyph-identity-keyed CPU encode + GPU residence for Geode text rendering.

A text run draws the same handful of outlines over and over: the letter "e" in a paragraph is one outline placed at fifty positions. Encoding and uploading that outline once per occurrence per frame is the dominant cost of a text frame - the outline has to be fetched from the font backend, transformed into place, banded into analytic dual-ray data, and pushed to the GPU, every time.

This cache breaks the occurrence apart: everything that depends only on glyph identity (the outline, its encode, and its GPU residence) is kept once, and everything that depends on the occurrence (position, rotation, colour) rides in a per-occurrence instance record. A repeated glyph then costs one record instead of a re-encode plus a re-upload.

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::GeodeTextShapeCache::Shape

struct donner::geode::GeodeTextShapeCache::Shape

One retained shape: its geometry key, encode and residence.

Class Members
EncodedPath encoded Encode of path; its address is stable.
GeodeResidentGradientSlot gradientSlot Residence for gradient paint.
Path path Exact geometry the encode was built from.
uint64_t retainedBytes = 0 Bytes charged for this shape.
FillRule rule = FillRule::NonZero Fill rule the encode was built for.
GeodeResidentSlot slot Residence for solid and pattern paint.
uint64_t toleranceBits = 0 Raw bits of the encode tolerance.