Skip to content

SpriteBatcher.Flush(IDrawContext) Method

Definition

Namespace: Brine2D.Rendering

Flushes all batched sprites to the renderer. Automatically sorts and groups sprites before submission to minimize state changes and draw calls. Sorts a lightweight index array rather than the full batch items to reduce swap cost.

public void Flush(Brine2D.Rendering.IDrawContext drawContext);

Parameters

drawContext IDrawContext

The draw context to submit draw calls to.

Remarks

The caller must ensure that drawContext is in a valid state to accept draw calls (e.g., between BeginFrame/EndFrame when backed by a GPU renderer). If the context silently discards commands, all flushed sprites will be lost without error.

After this method returns, the draw context may still hold buffered geometry that has not been submitted to the GPU. The caller (or a subsequent frame-lifecycle method such as EndFrame) is responsible for triggering the final GPU flush.