Expand description
Persistent per-pipeline streaming buffers.
Each frame, the renderer accumulates vertex data into per-pipeline
batches and flushes them to the GPU. The historical code path called
device.create_buffer_init on every flush, allocating and dropping
a fresh wgpu::Buffer pair (vertex + index) per batch โ a known
antipattern that causes driver allocation pressure at high glyph
counts.
StreamBuffer owns a single growable GPU buffer that persists
across frames. StreamBuffer::ensure_capacity is called once per
frame with the worst-case byte count (requires &mut self), growing
the underlying buffer if needed. After that, StreamBuffer::write
copies a batch to the GPU at the current write offset and advances
the cursor โ all via interior mutability, so calls can interleave
freely with other &self methods on the renderer.
Structsยง
- Stream
Buffer - A growable, ring-reset GPU buffer for streaming vertex or index data across contiguous batches within a single frame.
- Stream
Buffers - All per-pipeline streaming buffers owned by a
Renderer.