Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The GPUAdapter interface of the WebGPU API represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
A GPUAdapter object is requested using the GPU.requestAdapter() method.
features Read onlyA GPUSupportedFeatures object that describes additional functionality supported by the adapter.
info Read onlyA GPUAdapterInfo object containing identifying information about the adapter.
limits Read onlyA GPUSupportedLimits object that describes the limits supported by the adapter.
isFallbackAdapter Read only A boolean value. Returns true if the adapter is a fallback adapter, and false if not. This property has been removed from the web platform. Use GPUAdapterInfo.isFallbackAdapter instead.
requestAdapterInfo() Returns a Promise that fulfills with a GPUAdapterInfo object containing identifying information about the adapter.
requestDevice()Returns a Promise that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
async function init() {
if (!navigator.gpu) {
throw Error("WebGPU not supported.");
}
const adapter = await navigator.gpu.requestAdapter();
if (!adapter) {
throw Error("Couldn't request WebGPU adapter.");
}
const device = await adapter.requestDevice();
// …
}