GPUAdapter
WebGPU API
WebGPU API
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.
Instance properties
- features
- : A GPUSupportedFeatures object that describes additional functionality supported by the adapter.
- info
- : A GPUAdapterInfo object containing identifying information about the adapter.
- limits
- : A GPUSupportedLimits object that describes the limits supported by the adapter.
Deprecated properties
- isFallbackAdapter
- : A boolean value. Returns
trueif the adapter is a fallback adapter, andfalseif not. This property has been removed from the web platform. Use GPUAdapterInfo.isFallbackAdapter instead.
Instance methods
- 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.
Examples
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();
// …
}
Specifications
Browser compatibility
See also
- The WebGPU API