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...
|
|
| GeodeTextShapeCache (const GeodeTextShapeCache &)=delete |
|
GeodeTextShapeCache & | operator= (const GeodeTextShapeCache &)=delete |
|
| GeodeTextShapeCache (GeodeTextShapeCache &&) noexcept=default |
|
GeodeTextShapeCache & | operator= (GeodeTextShapeCache &&) noexcept=default |
| Shape * | find (size_t index, const Path &path, FillRule rule, double tolerance) |
| | Shape index when it holds exactly path, rule and tolerance, else null.
|
| Shape * | store (size_t index, const Path &path, FillRule rule, double tolerance, EncodedPath &encoded, const std::shared_ptr< GeodeDocumentGeometryBudget > &budget, size_t maximumShapes) |
| | Keeps encoded as shape index, replacing whatever the shape held, and returns it.
|
| void | release (size_t index) |
| | Drops shape index and its charge, leaving its ordinal empty: a draw whose new geometry could not be kept does not keep the old geometry it replaced either.
|
| void | trim (size_t count) |
| | Drops the shapes from count on, which the element's last draw did not reach.
|
|
size_t | size () const |
| | Number of ordinals held, empty ones included, until the next draw trims those it did not reach.
|
|
size_t | keptShapes () const |
| | Number of ordinals that hold a kept shape.
|
|
uint64_t | retainedBytes () const |
| | Bytes charged to the document's cache budget for this cache.
|
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.
These shapes are built in the element's own space every frame, so the draw that paints them is the same draw a per-frame encode would feed, and keeping them lets an unchanged frame encode, upload and bind nothing for them.
Shape i is the element's ith such draw in paint order. A draw reuses shape i only when the path it is about to paint, its fill rule and the encode tolerance are bitwise identical to what the shape holds; any difference replaces the shape, with fresh residence. Because the key is the geometry itself, no edit can leave a shape stale: an edit that changes what is painted changes the path, and an edit that only changes the paint reaches the draw's uniform as it does for any resident fill.
Bounded by the renderer's shape cap (kDefaultMaximumShapes) per element and device; draws past it, or one the document's cache budget refuses, encode for the frame as before, and a refused draw leaves its ordinal empty, so the shapes after it are still kept. Every shape's retained bytes (kShapeOverheadBytes plus its path and encode capacities) and the owner vector's capacity are charged to the document's cache budget, and its GPU geometry to the document's resident budget through the slab.
A shape is replaced or dropped only while no frame that has not submitted drew the element (lastFrame, a device-scoped generation, as for GeodeOccurrenceRecords). Its residence then returns through the slab's deferred free and bind-group retirement, which also covers an element destroyed while such a frame is open.