melonJS
    Preparing search index...

    Class WebGPUBatcher

    The base WebGPU Batcher — realizes the backend-neutral Batcher lifecycle (init / bind / unbind / flush / reset / destroy, driven by renderer.addBatcher / setBatcher) on a GPURenderPassEncoder instead of GL state. Custom WebGPU batchers extend this class.

    A "flush" here is one queue.writeBuffer of the pending vertex bytes into a fresh region of the renderer's per-frame buffer arena, plus one draw recorded into the frame's open pass — nothing is submitted until the frame ends. Attribute layouts are declared in the backend-neutral vocabulary of src/video/gpu/vertexformat.ts and consumed declaratively into the pipeline's GPUVertexBufferLayout (#1492) — no enum bridge.

    Hierarchy (View Summary)

    Index
    attributes: { bytes: number; format: any; name: any; offset: any }[] | undefined
    device: GPUDevice | undefined
    renderer: Renderer | undefined

    the renderer this batcher is bound to

    shaderKey: string | undefined
    stride: any
    topology: string | undefined
    vertexData: VertexArrayBuffer | undefined
    vertexSize: number | undefined
    • Initialize (or re-initialize after device loss) this batcher.

      Parameters

      • renderer: WebGPURenderer

        the owning renderer

      • Optionalsettings: {
            attributes?: object[];
            maxVertices?: number;
            shaderKey?: string;
            topology?: string;
        }

        batcher settings

        • Optionalattributes?: object[]

          neutral attribute descriptors

        • OptionalmaxVertices?: number

          staging capacity in vertices

        • OptionalshaderKey?: string

          pipeline-cache shader family

        • Optionaltopology?: string

          default portable topology

      Returns void

    • record the actual draw call — non-indexed by default; the quad batcher overrides with its indexed 6-per-quad pattern

      Parameters

      • pass: GPURenderPassEncoder

        the open pass

      • vertexCount: number

        pending vertex count

      Returns void