pub struct GlyphBatch2d { /* private fields */ }Expand description
A retained, ordered snapshot of prepared glyph placements sharing one atlas.
One instance buffer holds all glyphs. Only adjacent placements with identical clips are merged; glyphs are never reordered. A shared clip therefore needs at most one draw, while distinct adjacent clips require separate scissor draws. The entire batch is one frame item and cannot interleave other frame sources inside it. Use separate batches at painter-order boundaries.
Updates reuse CPU/GPU capacity and equal sprite input causes no upload. A frame reuses exact sprite geometry proofs at an unchanged viewport. Device restoration clears proofs and requires the restored original atlas.
Implementations§
Source§impl GlyphBatch2d
impl GlyphBatch2d
Sourcepub const fn placement_count(&self) -> usize
pub const fn placement_count(&self) -> usize
Returns the number of submitted placements, including empty source runs.
Sourcepub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
Returns the total retained glyph count across all placements.
Sourcepub fn draw_count(&self) -> usize
pub fn draw_count(&self) -> usize
Returns the conservative draw count before viewport clipping.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns reusable glyph storage capacity, excluding clip metadata.
Sourcepub const fn budget(&self) -> GlyphBatchBudget
pub const fn budget(&self) -> GlyphBatchBudget
Returns the limits retained for updates and device restoration.
Sourcepub fn recovery_memory_bytes(&self) -> usize
pub fn recovery_memory_bytes(&self) -> usize
Returns CPU recovery/conversion/clip capacity bytes, excluding source runs.
Sourcepub fn gpu_allocation_bytes(&self) -> usize
pub fn gpu_allocation_bytes(&self) -> usize
Returns actual GPU instance-buffer allocation bytes, including spare capacity.