Class WebGPUContext

WebGPU context Manages all the webgpu resources here.

Hierarchy

  • WebGPUContext

Constructors

Properties

device: GPUDevice
memory: Memory

Methods

  • Bind a canvas element to the runtime.

    Parameters

    • canvas: HTMLCanvasElement

      The HTML canvas/

    Returns void

  • Clear canvas

    Returns void

  • Copy raw bytes into buffer ptr.

    Parameters

    • rawBytes: Uint8Array

      The raw bytes

    • toPtr: number

      The target gpu buffer ptr

    • toOffset: number

      The beginning offset

    • nbytes: number

      Number of bytes

    Returns void

  • Create a PackedFunc that runs the given shader via createComputePipeline

    Parameters

    Returns Function

    The shader

  • Create a PackedFunc that runs the given shader asynchronously via createComputePipelineAsync

    Parameters

    Returns Promise<Function>

    The shader

  • Dispose context.

    Returns void

  • Draw image from data in storage buffer.

    Parameters

    • ptr: number

      The GPU ptr

    • height: number

      The height of the image.

    • width: number

      The width of the image.

    Returns void

  • Get the device API according to its name

    Parameters

    • name: string

    Returns Function

    The corresponding device api.

  • Obtain the runtime information in readable format.

    Returns string

  • Wait for all pending GPU tasks to complete

    Returns Promise<void>

Generated using TypeDoc