GPU

open class GPU(source)

The GPU interface of the WebGPU API is the starting point for using WebGPU. It can be used to return a GPUAdapter from which you can request devices, configure features and limits, and more. Available only in secure contexts.

MDN Reference

Properties

Link copied to clipboard

The wgslLanguageFeatures read-only property of the GPU interface returns a WGSLLanguageFeatures object that reports the WGSL language extensions supported by the WebGPU implementation.

Functions

Link copied to clipboard

The getPreferredCanvasFormat() method of the GPU interface returns the optimal canvas texture format for displaying 8-bit depth, standard dynamic range content on the current system.

Link copied to clipboard
inline suspend fun GPU.requestAdapter(): GPUAdapter?
inline suspend fun GPU.requestAdapter(options: GPURequestAdapterOptions): GPUAdapter?

The requestAdapter() method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.

Link copied to clipboard
fun requestAdapterAsync(options: GPURequestAdapterOptions = definedExternally): Promise<GPUAdapter?>

The requestAdapter() method of the GPU interface returns a Promise that fulfills with a GPUAdapter object instance. From this you can request a GPUDevice, adapter info, features, and limits.