Documentation
    Preparing search index...

    Interface WgpuRenderBatching

    The batching support a WebgpuRenderer draws through when an application assigns one — the interface, so the renderer names no implementation and this module drops out of a bundle that never asks for it (gl-batch.ts's RenderBatching, restated for this backend's contract).

    Implemented by WgpuBatching; construct one with createWgpuBatching. Named WgpuRenderBatching because the WebGL backend exports RenderBatching for its own, GL-shaped contract (draw(gl, program, …)), and one name for two per-backend interfaces across the workspace is the WgpuCacheableTexture confusion again.

    interface WgpuRenderBatching {
        beginFrame(): void;
        dispose(): void;
        draw(
            device: GpuDevice,
            pass: GpuRenderPassEncoder,
            batch: RenderBatch,
        ): void;
        forget(): void;
        next(
            items: readonly RenderItem[],
            from: number,
            layerMask?: number,
        ): RenderBatch | null;
    }

    Implemented by

    Index
    • Resets the frame's slot counter (see the module header) — called once per frame by the renderer, before any view is recorded. A renderer with batching: null calls nothing at all, which is the byte-identity half of the contract.

      Returns void

    • Uploads batch into this frame's next slot and records its single indexed draw into pass — the vertex-buffer bind, the index-buffer bind and the drawIndexed.

      Everything a draw shares with the ordinary path stays with the caller: the pipeline, the group-0 uniform block (identity model — positions arrive in world space — and the batch's colour), the group-1 texture bind, the stencil reference, and §84's counting. A later ordinary draw needs no restore: vertex and index bindings are re-issued per draw on this backend anyway, which is one more place the pass-command model is structurally safer than GL's ambient state.

      Parameters

      Returns void

    • Plans and assembles the batch starting at items[from], or null when that item does not start one — RenderBatcher.next, forwarded verbatim, layerMask included for gl-batch.ts's recorded reason (the renderer no longer passes one over a pre-filtered view list; a caller batching an unfiltered frame list still may).

      Parameters

      • items: readonly RenderItem[]
      • from: number
      • OptionallayerMask: number

      Returns RenderBatch | null