A representation of a compute shader with the associated resources, that can be executed on the GPU. Only supported on WebGPU platform.

Constructors

  • Create a compute instance. Note that this is supported on WebGPU only and is a no-op on other platforms.

    Parameters

    • graphicsDevice: GraphicsDevice

      The graphics device.

    • shader: Shader

      The compute shader.

    • Optional name: string = 'Unnamed'

      The name of the compute instance, used for debugging only.

    Returns Compute

Properties

name: string

The non-unique name of an instance of the class. Defaults to 'Unnamed'.

Methods

  • Prepare the compute work dispatch.

    Parameters

    • x: number

      X dimension of the grid of work-groups to dispatch.

    • Optional y: number

      Y dimension of the grid of work-groups to dispatch.

    • Optional z: number

      Z dimension of the grid of work-groups to dispatch.

    Returns void