API

Interface IDrawContext

Interface representing a draw context at the GPU level (draw call)

interface IDrawContext {
    enableIndirectDraw: boolean;
    indirectDrawBuffer?: GPUBuffer;
    uniqueId: number;
    useInstancing: boolean;
    dispose(): void;
    reset(): void;
    setIndirectData(
        indexOrVertexCount: number,
        instanceCount: number,
        firstIndexOrVertex: number,
        forceUpdate?: boolean,
    ): void;
}

Implemented by

Index
enableIndirectDraw: boolean

Indicates if the draw should be an indirect draw.

indirectDrawBuffer?: GPUBuffer

Buffer used for the indirect draw call when enableIndirectDraw is true.

uniqueId: number

Unique identifier for the draw context.

useInstancing: boolean

True if instances are used in the draw calls

  • Data for the indirect draw call (only used when enableIndirectDraw is true).

    Parameters

    • indexOrVertexCount: number

      The number of indices (if indexed draw) or vertices (if non-indexed draw).

    • instanceCount: number

      The number of instances to draw.

    • firstIndexOrVertex: number

      The index (if indexed draw) or vertex (if non-indexed draw) offset to start drawing from.

    • OptionalforceUpdate: boolean

      If true, forces the update of the indirect draw data even if instanceCount is the same as in the previous call.

    Returns void