|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
Document-scoped, painter-ordered record slab for ordered draw batching (ordered batching). More...
#include "donner/svg/renderer/geode/GeodeResidentPathComponent.h"
Classes | |
| struct | Slot |
| One record slot: its index in the contiguous array and its absolute byte offset in the owning buffer. More... | |
| struct | BatchUniformHandle |
| A batch-uniform buffer plus its stable identity; buffer is null when the slab declined (uniform cache full, or buffer creation failed). More... | |
Public Member Functions | |
| GeodeRecordSlab (uint64_t deviceId, std::shared_ptr< GeodeDocumentGeometryBudget > budget=nullptr) | |
| GeodeRecordSlab (const GeodeRecordSlab &)=delete | |
| GeodeRecordSlab & | operator= (const GeodeRecordSlab &)=delete |
| uint64_t | owningDeviceId () const |
| const std::shared_ptr< GeodeDocumentGeometryBudget > & | documentBudget () const |
| void | beginFrame (uint64_t frameIndex) |
| Merge the previous frame's freed slots into the reusable free list. The frame-index guard makes the merge idempotent per frame (mirrors the geometry slab's contract: a second renderer on the same device has its own frame counter, and a stale-index skip only defers the merge in the safe direction). | |
| void | retireBindGroup (gpu::BindGroup bindGroup) |
| Park a bind group a slot is dropping until the next frame boundary. | |
| bool | allocateSlot (GeodeDevice &device, Slot &out) |
| Allocate the next record slot (free-list first, then bump in the newest buffer). Returns false when the device cannot create a buffer. | |
| void | freeSlot (const Slot &slot) |
| Defer freeing a slot until the next frame: a slot reused within the frame that freed it would overwrite a record the frame's already recorded batch draws still read. | |
| BatchUniformHandle | acquireBatchUniform (GeodeDevice &device, const void *bytes, uint64_t size) |
| Persistent buffer holding one distinct scene-batch uniform value. | |
| const gpu::Buffer & | bufferForId (uint64_t bufferId) const |
The chunk buffer carrying bufferId, or a null handle when this slab does not own it. Uploads need the owning handle; Slot and Allocation only carry an identity view. | |
| gpu::BufferRef | newestBuffer () const |
| Borrowed handle of the newest buffer (batches bind sub-ranges of it). | |
| uint64_t | newestBufferUsedBytes () const |
| Bytes currently in use in the newest buffer. | |
| uint64_t | liveBytes () const |
| Total live bytes across all buffers (resident-bytes accounting). | |
| uint64_t | batchUniformMetadataBytesForTesting () const |
| uint64_t | batchUniformPayloadBytesForTesting () const |
Static Public Member Functions | |
| static std::optional< uint64_t > | batchUniformRetainedBytes (uint64_t uniformBytes) |
Document-scoped, painter-ordered record slab for ordered draw batching (ordered batching).
Cross-entity batches issue ONE draw whose instances read instances[firstInstance + i] from a contiguous record array. Records therefore live in a document-scoped slab instead of inside each entity's geometry chunk: slot indices are allocated in draw order, freed ranges defer to the next frame (the same discipline as GeodeResidentSlab::beginFrame), and a batch covers only consecutive slots of one buffer, splitting at free-list reuse or buffer-growth boundaries.
Buffer growth keeps old slots in place: a grown slab allocates a bigger buffer and future slots land there, so no record ever moves. Batches that would straddle the buffer boundary split instead.
Bound to one device like GeodeResidentSlab; not thread-safe.
| struct donner::geode::GeodeRecordSlab::Slot |
One record slot: its index in the contiguous array and its absolute byte offset in the owning buffer.
| Class Members | ||
|---|---|---|
| BufferRef | buffer | |
| uint64_t | bufferId = 0 | Stable identity of buffer (see GeodeDevice::AllocateBufferId). Anything that caches keyed on this slot must compare the id: the handle address is recycled once the owning slab is destroyed. |
| uint32_t | index = 0 | |
| uint64_t | offset = 0 | |
| struct donner::geode::GeodeRecordSlab::BatchUniformHandle |
|
inline |
Persistent buffer holding one distinct scene-batch uniform value.
A batch uniform is frame-constant (identity mvp plus the frame's viewport / clip / antialias state), so a steady frame finds its entry and writes nothing at all - the per-frame arena would rewrite it every frame because the arena's bytes do not survive.
Entries are keyed by their exact bytes and are never rewritten, so a differing value (a second render-target size within one frame) takes a new entry and a batch already recorded this frame keeps reading its own bytes at submit time. Returns a null handle once kMaxBatchUniforms distinct values are live, and the caller falls back to its per-frame arena.
|
inline |
The chunk buffer carrying bufferId, or a null handle when this slab does not own it. Uploads need the owning handle; Slot and Allocation only carry an identity view.
| bufferId | Stable buffer id stamped on the slot or allocation. |
|
inline |
Park a bind group a slot is dropping until the next frame boundary.
A slot's cached bind group can be dropped mid-frame (geometry re-upload, component removal, device change) while draws recorded earlier in the frame still name it and have not reached the backend yet. Destroying it there fails those draws closed, so it is held here and released at the next beginFrame, by which point the frame that recorded them has been submitted.
| bindGroup | Bind group to release at the next frame boundary. |