Document-scoped, painter-ordered record slab for ordered draw batching (ordered batching).
More...
|
| | GeodeRecordSlab (uint64_t deviceId, std::weak_ptr< GeodeHandleRetirement > owner, std::shared_ptr< GeodeDocumentGeometryBudget > budget=nullptr) |
|
| GeodeRecordSlab (const GeodeRecordSlab &)=delete |
|
GeodeRecordSlab & | operator= (const GeodeRecordSlab &)=delete |
|
uint64_t | owningDeviceId () const |
| | Device on which this record slab's buffers were created.
|
|
const std::shared_ptr< GeodeDocumentGeometryBudget > & | documentBudget () const |
| | Document budget charged for resident records, if one was supplied.
|
|
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 device-scoped generation. Callers defer this merge while an older frame remains open on the device, because its unsubmitted commands may still reference freed slots and retired bind groups.
|
| 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.
|
|
uint64_t | liveBytes () const |
| | Total live bytes across all buffers (resident-bytes accounting).
|
|
uint64_t | batchUniformMetadataBytesForTesting () const |
| | Capacity bytes held by batch-uniform metadata, exposed to tests.
|
|
uint64_t | batchUniformPayloadBytesForTesting () const |
| | Capacity bytes held by CPU uniform payloads, exposed to tests.
|
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.
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.
| void donner::geode::GeodeRecordSlab::retireBindGroup |
( |
gpu::BindGroup | bindGroup | ) |
|
|
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, encode 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.
- Parameters
-
| bindGroup | Bind group to release at the next frame boundary. |