pixi.js
    Preparing search index...

    Class PipelineSystemAdvanced

    A system that creates and manages the GPU pipelines.

    Caching Mechanism: At its core, the system employs a two-tiered caching strategy to minimize the redundant creation of GPU pipelines (or "pipes"). This strategy is based on generating unique keys that represent the state of the graphics settings and the specific requirements of the item being rendered. By caching these pipelines, subsequent draw calls with identical configurations can reuse existing pipelines instead of generating new ones.

    State Management: The system differentiates between "global" state properties (like color masks and stencil masks, which do not change frequently) and properties that may vary between draw calls (such as geometry, shaders, and blend modes). Unique keys are generated for both these categories using getStateKey for global state and getGraphicsStateKey for draw-specific settings. These keys are then then used to caching the pipe. The next time we need a pipe we can check the cache by first looking at the state cache and then the pipe cache.

    Implements

    Index

    Constructors

    Accessors

    • get bundleStateKey(): number

      A packed key for everything a render bundle recorded right now would bake into itself: the attachment state WebGPU validates when the bundle is executed (color format(s), color target count, depth/stencil format, sample count, read-only aspects), plus the front-face winding its pipelines capture — which WebGPU does not validate.

      Equal keys mean a bundle recorded then is compatible with, and correct for, the pass now; different keys mean it has to be re-recorded before it is replayed. Comparing the two is what GpuEncoderSystem.isBundleValid does.

      colorMask and stencilMode are deliberately left out, unlike the pipeline cache key: they are ambient draw state a bundle bakes per-pipeline as it records, so their value at execute time says nothing about whether the bundle is still good.

      Returns number

    Methods

    • Generic destroy methods to be overridden by the subclass

      Returns void

    • Returns a hash of buffer names mapped to bind locations. This is used to bind the correct buffer to the correct location in the shader.

      Parameters

      • geometry: Geometry

        The geometry where to get the buffer names

      • program: GpuProgram

        The program where to get the buffer names

      Returns Record<string, string>

      An object of buffer names mapped to the bind location.

    • Builds a GPURenderBundleEncoderDescriptor that matches the current render target configuration (color formats, sample count, depth/stencil format, and which of its aspects are read-only). Used by GpuEncoderSystem.beginBundle to create a compatible render bundle encoder.

      Returns GPURenderBundleEncoderDescriptor

      A descriptor for creating a GPURenderBundleEncoder.

    • Generates a key for the pipeline.advanced usage only.

      Parameters

      • geometry: Geometry

        The geometry to get the key for

      • program: GpuProgram

        The program to get the key for

      • state: State

        The state to get the key for

      • topology: Topology

        The topology to get the key for

      • overrides: ShaderOverrides

        The overrides to get the key for

      Returns number

      The key for the pipeline

    • Parameters

      • colorMask: number

      Returns void

    • Parameters

      • multisampleCount: number

      Returns void