Interface GPU

Minimal WebGPU-like rendering interface.

Hierarchy

  • GPU

Methods

  • Starts a render pass.

    Parameters

    • device: Device

      the GPU device

    • Optional pass: null | RenderPass

      the render pass

    Returns void

  • Copies data from a buffer to another buffer.

    Parameters

    • device: Device

      the GPU device

    • src: Buffer

      the buffer to read from

    • dst: Buffer

      the buffer to write to

    • Optional size: number

      the byte size of the GPU buffer to read. Defaults to the whole buffer

    • Optional srcOffset: number

      the byte offset into src buffer to begin reading from. Defaults to 0

    • Optional dstOffset: number

      the byte offset into dst buffer to begin writing to. Defaults to 0

    Returns void

  • Copies subregion of a texture to another texture.

    Parameters

    Returns void

  • Copies subregion of a texture to a buffer.

    Parameters

    • device: Device

      the GPU device

    • src: ImageCopyTexture

      the texture subregion to read from.

    • dst: Buffer

      the buffer to write to

    • layout: ImageDataLayout

      the buffer data layout to use for storing the texture

    • Optional size: Extent3D

      the size of the texture subregion to copy

    Returns void

  • Submits a draw call in the current render pass.

    Parameters

    • device: Device

      the GPU device

    • vertexCount: number

      the number of vertices to draw

    • Optional instanceCount: number

      the number of instances to draw. Defaults to 1

    • Optional firstVertex: number

      the offset to the first vertex to draw. Defaults to 0

    • Optional firstInstance: number

      the offset to the first instance to draw. Defaults to 0

    Returns void

  • Submits an indexed draw call in the current render pass.

    Parameters

    • device: Device

      the GPU device

    • indexCount: number

      the number of vertices to draw

    • Optional instanceCount: number

      the number of instances to draw. Defaults to 1

    • Optional firstIndex: number

      the offset to the first vertex to draw. Defaults to 0

    • Optional firstInstance: number

      the offset to the first instance to draw. Defaults to 0

    Returns void

  • Flushes the command buffer.

    Parameters

    • device: Device

      the GPU device

    Returns void

  • Gets the enabled features of the device.

    Parameters

    • device: Device

      the GPU device

    Returns number

    enabled features bitflag

  • Returns if device context is lost.

    Parameters

    • device: Device

      the GPU device

    Returns boolean

    true if device context is lost

  • Reads data from a buffer.

    Parameters

    • device: Device

      the GPU device

    • buffer: Buffer

      the GPU buffer to read from

    • out: Uint8Array

      the output buffer

    • Optional offset: number

      the byte offset into GPU buffer to begin reading from. Defaults to 0

    Returns Future<unknown>

    a future

  • Resets the device state.

    Parameters

    • device: Device

      the GPU device

    Returns void

  • Binds a bind group to the current render pass.

    Parameters

    • device: Device

      the GPU device

    • slot: number

      the bind group slot to bind to

    • bindGroup: BindGroup

      the bind group to use

    • Optional offsets: UIntArray

      the dynamic offsets for dynamic buffers in this bind group

    Returns void

  • Sets the blend-constant color for the current render pass.

    Parameters

    • device: Device

      the GPU device

    • color: Color

      the blend color

    Returns void

  • Binds an index buffer to the current render pass.

    Parameters

    • device: Device

      the GPU device

    • buffer: Buffer

      the buffer to bind

    Returns void

  • Binds a RenderPipeline to the current render pass.

    Parameters

    Returns void

  • Sets the scissor rectangle for the current render pass.

    Parameters

    • device: Device

      the GPU device

    • x: number

      x offset

    • y: number

      y offset

    • width: number

      width

    • height: number

      height

    Returns void

  • Sets the stencil reference value for the current render pass.

    Parameters

    • device: Device

      the GPU device

    • ref: number

      the stencil reference value.

    Returns void

  • Binds a vertex buffer to a slot in the current render pass.

    Parameters

    • device: Device

      the GPU device

    • slot: number

      the vertex slot to bind to

    • buffer: Buffer

      the buffer to bind

    • Optional offset: number

    Returns void

  • Sets the 3D viewport area for the current render pass.

    Parameters

    • device: Device

      the GPU device

    • x: number

      x offset

    • y: number

      y offset

    • width: number

      width

    • height: number

      height

    • Optional minDepth: number

      min depth. Defaults to 0

    • Optional maxDepth: number

      max depth. Defaults to 1

    Returns void

  • Submits the current render pass.

    Parameters

    • device: Device

      the GPU device

    Returns void

  • Writes data to a buffer.

    Parameters

    • device: Device

      the GPU device

    • buffer: Buffer

      the buffer to write to

    • data: ArrayBufferView

      the buffer data

    • Optional offset: number

      the byte offset into GPU buffer to begin writing to. Defaults to 0

    Returns void

  • Writes subregion of data array to a texture.

    Parameters

    • device: Device

      the GPU device

    • texture: ImageCopyTexture

      the texture subregion to write to.

    • data: ArrayBufferView

      the texture data

    • layout: ImageDataLayout

      the data layout

    • Optional size: Extent3D

      the size of the data subregion to write

    Returns void

Generated using TypeDoc