Persistent per-occurrence instance records for content drawn more than once over shared resident geometry: the glyph occurrences of one text element, or the second and later draws of one resident slot within a frame (each marker placement of a marker's content, a non-adjacent repeat of a <use> source).
More...
|
|
| GeodeOccurrenceRecords (const GeodeOccurrenceRecords &)=delete |
|
GeodeOccurrenceRecords & | operator= (const GeodeOccurrenceRecords &)=delete |
| | GeodeOccurrenceRecords (GeodeOccurrenceRecords &&other) noexcept |
| | Transfer occurrence slots and CPU reservations without freeing live slab records.
|
| GeodeOccurrenceRecords & | operator= (GeodeOccurrenceRecords &&other) noexcept |
| | Release current slots and take ownership of another component's records.
|
| bool | reserveOccurrence (std::shared_ptr< GeodeDocumentGeometryBudget > budget) |
| | Reserve CPU bytes and vector capacity before appending one occurrence.
|
| bool | appendReservedOccurrence (const GeodeRecordSlab::Slot &slot) |
| | Append a slab slot after reserveOccurrence has admitted its CPU payload.
|
|
void | rollbackOccurrence () |
| | Restore the CPU reservation after an occurrence append fails.
|
|
uint64_t | cpuRetainedBytesForTesting () const |
| | CPU bytes currently charged for this component, exposed to tests.
|
| GeodeClipUniform * | reserveClipUniform (Occurrence &occurrence, size_t bytes) |
| | The clip uniform of occurrence, created and charged with the occurrence's other CPU bytes on first use: the record of its range and a copy of bytes bytes of uniform.
|
|
void | releaseClipUniforms () |
| | Return every occurrence's clip uniform range to clipUniformSlab (deferred to its next frame boundary, like every other slab free) and drop the uniforms and their charge.
|
|
void | freeRecordSlots () |
| | Return every slot to the slab (deferred to the next frame's merge, like every other record free) and drop them.
|
|
|
std::vector< OccurrenceOwner > | occurrences |
| | Occurrence slots in paint order. Index is the occurrence's ordinal among its owner's draws in one frame, so it is stable across unchanged frames. Owners may move when the vector grows, but each separately allocated occurrence stays put while a pending batch holds pointers into it.
|
|
std::shared_ptr< GeodeRecordSlab > | recordSlab |
| | Slab the slots were allocated from, this device's record slab for the document; also keeps that slab alive for as long as the slots are.
|
|
uint64_t | lastFrame = 0 |
| | Device-scoped frame generation of the last draw that wrote these slots. Zero means "never written": generations start at 1, and the guard reads this as "older than every open frame", which is what untouched records are.
|
|
std::shared_ptr< GeodeDocumentGeometryBudget > | cpuBudget |
| | Document budget for CPU records.
|
|
GeodeGeometryCacheReservation | cpuReservation |
| | Owned CPU-byte reservation.
|
|
uint64_t | cpuRetainedBytes = 0 |
| | Charged owner and record bytes. Geometry slab every occurrence's clipUniform range comes from: the slab of the slot whose draws the occurrences repeat, on the same device. Null until an occurrence first draws under a clip polygon.
|
|
std::shared_ptr< GeodeResidentSlab > | clipUniformSlab |
Persistent per-occurrence instance records for content drawn more than once over shared resident geometry: the glyph occurrences of one text element, or the second and later draws of one resident slot within a frame (each marker placement of a marker's content, a non-adjacent repeat of a <use> source).
The geometry is shared, so the thing that has to exist once per OCCURRENCE is the record: transform, colour, clip rectangle, and the shared geometry's chunk-relative bases. Handing every occurrence a fresh record slot each frame would work, but it would also write 256 bytes per occurrence per frame forever, which keeps a static frame off the zero-bytes steady state the rest of the renderer reaches.
So the slots live on their owner (a text element, one set per device that draws it, see GeodeTextInstanceResidencyComponent; or a resident slot, see GeodeResidentSlot::repeatRecords) and persist. Occurrence i of the owner always writes slot i, the bytes are compared before writing, and an unchanged frame writes nothing. Slots are allocated together on first use, in draw order, which keeps their indices consecutive - exactly the property a batch needs to cover them with one draw.
No explicit invalidation is needed when the content changes: a changed occurrence simply produces different record bytes for the affected slots, the compare misses, and those slots are rewritten. A frame with fewer occurrences leaves trailing slots unused (and free for the owner to grow back into); a frame with more appends.
lastFrame guards the one case the compare cannot: the same owner written twice while an earlier writer's draws are still unsubmitted - a text element drawn twice in one frame (a <use> of the text), or an offscreen pass rendering the same document inside an outer frame that has already recorded its batch. The second writer must not rewrite those records, because every buffer write in a frame executes before every draw in that frame's submit. lastFrame holds a DEVICE-scoped generation (GeodeDevice::beginFrameGeneration) so the comparison covers renderers sharing a device, and the renderer diverts the second writer to per-frame temporary slots instead.
An occurrence drawn under a clip polygon also keeps a uniform of its own (GeodeClipUniform): the polygon reaches the shader only through the draw-level uniform, which an ordered batch otherwise shares.