Interface GPUCanvasContext
canvas: OffscreenCanvas | HTMLCanvasElement;
configure(configuration: GPUCanvasConfiguration): void;
getConfiguration(): GPUCanvasConfiguration | null;
getCurrentTexture(): GPUTexture;
unconfigure(): void;
}
Properties
Readonlycanvas
The canvas read-only property of the GPUCanvasContext interface returns a reference to the canvas that the context was created from.
Methods
configure
-
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.Parameters
- configuration: GPUCanvasConfiguration
Returns void
getConfiguration
-
The
getConfiguration()method of the GPUCanvasContext interface returns the current configuration set for the context.Returns GPUCanvasConfiguration | null
getCurrentTexture
-
The
getCurrentTexture()method of the GPUCanvasContext interface returns the next GPUTexture to be composited to the document by the canvas context.Returns GPUTexture
unconfigure
-
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.Returns void
The
GPUCanvasContextinterface of the WebGPU API represents the WebGPU rendering context of aMDN Reference