GPUAdapterInfo

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

WebGPU APIGPUAdapterInfo 接口包含关于 GPUAdapter 的标识信息。

使用 GPUAdapter.requestAdapterInfo() 方法去请求 GPUAdapterInfo 对象。

实例属性

architecture 实验性 只读

适配器所属的 GPU 家族或类别的名称。如果不能获得,则返回空字符串。

description 实验性 只读

描述适配器的人类可读字符串。如果不能获得,则返回空字符串。

device 实验性 只读

适配器供应商的标识符。如果不能获得,则返回空字符串。

vendor 实验性 只读

适配器供应商的名称。如果不能获得,则返回空字符串。

示例

js
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 adapterInfo = await adapter.requestAdapterInfo();
  console.log(adapterInfo.architecture);
  console.log(adapterInfo.vendor);

  // ...
}

规范

Specification
WebGPU
# gpu-adapterinfo

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
GPUAdapterInfo
Experimental
architecture
Experimental
description
Experimental
device
Experimental
subgroupMaxSize
Experimental
subgroupMinSize
Experimental
vendor
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.
Has more compatibility info.

参见