A storage buffer represents a memory which both the CPU and the GPU can access. Typically it is used to provide data for compute shader, and to store the result of the computation. Note that this class is only supported on the WebGPU platform.

Constructors

Methods

Constructors

Methods

  • Clear the content of a storage buffer to 0.

    Parameters

    • Optionaloffset: number = 0

      The byte offset of data to clear. Defaults to 0.

    • Optionalsize: number = ...

      The byte size of data to clear. Defaults to the full size of the buffer minus the offset.

    Returns void

  • Issues a write operation of the provided data into a storage buffer.

    Parameters

    • bufferOffset: number = 0

      The offset in bytes to start writing to the storage buffer.

    • data: ArrayBufferView

      The data to write to the storage buffer.

    • dataOffset: number = 0

      Offset in data to begin writing from. Given in elements if data is a TypedArray and bytes otherwise.

    • size: number

      Size of content to write from data to buffer. Given in elements if data is a TypedArray and bytes otherwise.

    Returns void