|
|
| GeodeTextInstanceRecordComponent (const GeodeTextInstanceRecordComponent &)=delete |
|
GeodeTextInstanceRecordComponent & | operator= (const GeodeTextInstanceRecordComponent &)=delete |
| | GeodeTextInstanceRecordComponent (GeodeTextInstanceRecordComponent &&other) noexcept |
| | Transfer occurrence slots and CPU reservations without freeing live slab records.
|
| GeodeTextInstanceRecordComponent & | operator= (GeodeTextInstanceRecordComponent &&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.
|
|
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 within the element's draw, 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 an untouched component is.
|
|
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.
|
Persistent per-occurrence instance records for one text element.
Glyph geometry is shared, so the thing that has to exist once per OCCURRENCE is the record: transform, colour, and the shared outline's chunk-relative geometry bases. Handing every occurrence a fresh record slot each frame would work, but it would also write 256 bytes per glyph per frame forever, which keeps a static text frame off the zero-bytes steady state the rest of the renderer reaches.
So the slots live on the text element, one set per device that draws it (GeodeTextInstanceResidencyComponent), and persist. Occurrence i of the element always writes slot i, the bytes are compared before writing, and an unchanged frame writes nothing. Slots are bump-allocated together on first use, which keeps their indices consecutive - exactly the property a batch needs to cover them with one draw.
No explicit invalidation is needed when the text changes: a re-laid-out element simply produces different record bytes for the affected slots, the compare misses, and those slots are rewritten. A shorter run leaves trailing slots unused (and free for the element to grow back into); a longer one appends.
lastFrame guards the one case the compare cannot: the same element written twice while an earlier writer's draws are still unsubmitted - the same 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 glyph 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.