API

Interface DrawBinding

A per-pass draw binding produced by Renderable.bind(engine, target).

Target-specific GPU state (resolved pipeline(s), sceneBG, etc.) is captured in the draw closure so the binding itself has no material-specific payload. The same Renderable can be bound multiple times (once per pass it participates in) with a separate DrawBinding each time.

interface DrawBinding {
    pipeline: GPURenderPipeline;
    renderable: Renderable;
    draw(
        pass: GPURenderPassEncoder | GPURenderBundleEncoder,
        engine: EngineContext,
    ): number;
    update?(context: DrawUpdateContext): void;
}
Index
pipeline: GPURenderPipeline

Pipeline used by this binding. The render pass task owns setPipeline() and dedups consecutive bindings with the same pipeline.

renderable: Renderable

Back-reference for sort/eviction (order, mesh identity).

  • Issue draw commands for this renderable into pass. The render pass task has already set the scene bind group (group 0) and pass.setPipeline(pipeline) if it changed. The closure handles per-mesh / per-material bind groups, vertex/index buffers, and drawIndexed. Returns the number of GPU draw calls.

    Parameters

    • pass: GPURenderPassEncoder | GPURenderBundleEncoder
    • engine: EngineContext

    Returns number

  • Update dirty per-pass state before draw. Called once per frame per binding. Per-mesh state (e.g. world matrix) shared across bindings should be version-guarded to avoid redundant writes. Render task transparent sorting runs after these updates, so renderables may refresh _worldCenter here.

    Parameters

    Returns void