GPUCanvasContext

The GPUCanvasContext interface of the WebGPU API represents the WebGPU rendering context of a element, returned via an HTMLCanvasElement.getContext() call with a contextType of "webgpu". Available only in secure contexts.

MDN Reference

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The canvas read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.

Functions

Link copied to clipboard
fun configure(configuration: GPUCanvasConfiguration)

The configure() method of the GPUCanvasContext interface configures the context to use for rendering with a given GPUDevice. When called the canvas will initially be cleared to transparent black.

Link copied to clipboard

The getConfiguration() method of the GPUCanvasContext interface returns the current configuration set for the context.

Link copied to clipboard

The getCurrentTexture() method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.

Link copied to clipboard

The unconfigure() method of the GPUCanvasContext interface removes any previously-set context configuration, and destroys any textures returned via getCurrentTexture() while the canvas context was configured.