Skip to main content

Module batch

Module batch 

Source
Expand description

Batched glyph rendering — layer-sorted, blend-mode-separated instanced draw calls.

The renderer needs to:

  1. Sort all active glyphs by (RenderLayer, blend_mode) to minimize state changes
  2. Pack each batch into a GlyphInstance array for the GPU
  3. Issue one draw_arrays_instanced call per batch

§Batch key

(RenderLayer, BlendMode) — changes in either require a new draw call. Within each batch, instances are further sorted by Z (back-to-front) for transparent geometry.

Structs§

AtlasUploadTracker
Tracks which atlas pages have been uploaded this frame (avoids redundant uploads).
BatchKey
Determines which draw call a glyph belongs to.
BatchStats
Statistics from the last finish() call.
GlyphBatch
A CPU-side instance buffer for one draw call.
GlyphBatcher
Builds and sorts batches from a flat list of glyphs each frame.
GlyphInstance
Per-instance GPU data. Must match the vertex shader layout exactly.
PendingGlyph
Pending item — a glyph to be assigned to a batch.
RenderLayerOrd
Ordered wrapper for RenderLayer (to allow sorting by layer).

Enums§

BlendMode
GPU blend mode for a batch.