pixi.js
    Preparing search index...

    Class GpuEncoderSystemAdvanced

    The system that handles encoding commands for the GPU.

    Implements

    Index

    Constructors

    Properties

    commandEncoder: GPUCommandEncoder
    commandFinished: Promise<void>

    The active command target that draws and state are recorded into. This is the live render pass during normal rendering, or a GPURenderBundleEncoder while a render bundle is being recorded (see beginBundle). Both encoders expose the same render/bind command API the encoder relies on (GPURenderCommandsMixin + GPUBindingCommandsMixin), so callers write to it without caring which one is active. Pass-level commands (viewport, stencil, executeBundles, end) are not part of that shared API and go through _passEncoder.

    Methods

    • Begins recording a render bundle. While recording, all draw commands are captured into a GPURenderBundleEncoder instead of the active render pass. The current render pass encoder is saved and restored when endBundle is called.

      Render bundles allow pre-recording of draw commands that can be replayed multiple times via executeBundle, reducing CPU overhead for repeated draw sequences.

      Parameters

      • Optionallabel: string

        Optional debug label. Names the bundle in GPU captures and in the WebGPU validation errors it can raise when replayed, instead of (unlabeled).

      Returns void

      If a render bundle is already being recorded.

    • Parameters

      • gpuRenderTarget: GpuRenderTarget

      Returns void

    • Generic destroy methods to be overridden by the subclass

      Returns void

    • Parameters

      • options: {
            baseVertex?: number;
            firstInstance?: number;
            geometry: Geometry;
            instanceCount?: number;
            shader: Shader;
            size?: number;
            skipSync?: boolean;
            start?: number;
            state?: State;
            topology?: Topology;
        }

      Returns void

    • Sets up the pipeline, geometry, and bind groups then issues an indirect draw call. Uses drawIndexedIndirect when the geometry has an index buffer, otherwise drawIndirect. Draw parameters (vertex count, instance count, etc.) are read from the indirect buffer on the GPU.

      Parameters

      • options: {
            geometry: Geometry;
            indirectBuffer: GPUBuffer;
            indirectOffset: number;
            shader: Shader;
            skipSync?: boolean;
            state?: State;
            topology?: Topology;
        }

        The draw options.

        • geometry: Geometry

          The geometry to draw.

        • indirectBuffer: GPUBuffer

          The GPU buffer containing the indirect draw parameters.

        • indirectOffset: number

          Byte offset into the indirect buffer.

        • shader: Shader

          The shader to use.

        • OptionalskipSync?: boolean

          If true, skips syncing uniform groups to their GPU buffers.

        • Optionalstate?: State

          Optional render state (blending, depth, etc.).

        • Optionaltopology?: Topology

          Optional primitive topology override.

      Returns void

    • Returns void

    • Replays previously recorded render bundles on the current render pass. The bound state cache is cleared since a bundle may set its own pipeline, bind groups, and buffers.

      Pass a whole run of bundles rather than calling this once per bundle: WebGPU resets the pass state after every call, so N calls cost N cache clears and N trips through the binding layer for exactly the same result.

      Every bundle must have been recorded against a matching render target — check with isBundleValid first and re-record if it says no, as Pixi cannot rebuild your draw commands for you.

      Parameters

      Returns void

    • Returns void

    • Checks whether a recorded bundle can still be replayed against the render target that is bound now.

      A bundle permanently bakes the attachment state it was recorded with — color format(s), color target count, depth/stencil format, sample count — and WebGPU rejects the entire command buffer if any of it differs at execute time. It also bakes the front-face winding of its pipelines, which WebGPU does not validate: once the target's RenderTarget.flipY parity changes, replaying silently renders geometry inside out.

      Ask before replaying rather than after: only the caller owns the draw commands, so only the caller can re-record. A missing bundle reports false, so !isBundleValid(bundles[i]) reads correctly on the first frame, before anything has been recorded.

      Parameters

      Returns boolean

      true if the bundle is safe to execute right now, false if it must be re-recorded.

    • Returns void

    • Returns void

    • Parameters

      • index: number

      Returns void

    • Sets the stencil reference value for subsequent draws. This is a pass-level command, so it always targets the real render pass — not a bundle encoder, which cannot set stencil state.

      Parameters

      • stencilReference: number

        The stencil reference value to use.

      Returns void