tvmjs
    Preparing search index...

    Class WebGPUContext

    WebGPU context Manages all the webgpu resources here.

    Index

    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

      • finfo: FunctionInfo

        The function information already parsed as a record.

      • code: string

        The shader data(in WGSL)

      Returns Function

      The shader

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

      Parameters

      • finfo: FunctionInfo

        The function information already parsed as a record.

      • code: string

        The shader data(in WGSL)

      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

        The name of the API.

      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>