Class GPUAdapter
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The GPUAdapter interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} represents a GPU adapter. From this you can request a GPUDevice, adapter info, features, and limits.
[Value("GPUAdapter")]
public class GPUAdapter
- Inheritance
-
GPUAdapter
- Inherited Members
Remarks
A GPUAdapter object is requested using the RequestAdapter(GPURequestAdapterOptions) method.
-The WebGPU API
Constructors
GPUAdapter()
public GPUAdapter()
Properties
Features
The features read-only property of the
GPUAdapter interface returns a GPUSupportedFeatures object that describes additional functionality supported by the adapter.
[Value("features")]
public GPUSupportedFeatures Features { get; }
Property Value
- GPUSupportedFeatures
A GPUSupportedFeatures object instance. This is a setlike object.
Remarks
You should note that not all features will be available to WebGPU in all browsers that support it, even if the features are supported by the underlying hardware. This could be due to constraints in the underlying system, browser, or adapter. For example:
If you are hoping to take advantage of a specific additional feature in a WebGPU app, thorough testing is advised.
-The WebGPU API
Info
The info read-only property of the
GPUAdapter interface returns a GPUAdapterInfo object containing identifying information about the adapter.
[Value("info")]
public GPUAdapterInfo Info { get; }
Property Value
- GPUAdapterInfo
A GPUAdapterInfo object instance.
Remarks
IsFallbackAdapter
IMPORTANT
DeprecatedisFallbackAdapter read-only property of theGPUAdapter interface returns
true if the adapter is a fallback adapter, and false if not.
[Value("isFallbackAdapter")]
public bool IsFallbackAdapter { get; }
Property Value
- bool
A boolean.
Remarks
Limits
The limits read-only property of the
GPUAdapter interface returns a GPUSupportedLimits object that describes the limits supported by the adapter.
[Value("limits")]
public GPUSupportedLimits Limits { get; }
Property Value
- GPUSupportedLimits
A GPUSupportedLimits object instance.
Remarks
You should note that, rather than reporting the exact limits of each GPU, browsers will likely report different tier values of different limits to reduce the unique information available to drive-by fingerprinting. For example, the tiers of a certain limit might be 2048, 8192, and 32768. If your GPU's actual limit is 16384, the browser will still report 8192.
Given that different browsers will handle this differently and the tier values may change over time, it is hard to provide an accurate account of what limit values to expect — thorough testing is advised.
-The WebGPU API
Methods
RequestDevice(GPUDeviceDescriptor)
The requestDevice() method of the
GPUAdapter interface returns a {{jsxref("Promise")}} that fulfills with a GPUDevice object, which is the primary interface for communicating with the GPU.
[Value("requestDevice")]
public Task<GPUDevice> RequestDevice(GPUDeviceDescriptor descriptor = null)
Parameters
descriptorGPUDeviceDescriptor
Returns
- Task<GPUDevice>
A {{jsxref("Promise")}} that fulfills with a GPUDevice object instance.If you make a duplicate call, i.e., call
requestDevice()on a GPUAdapter thatrequestDevice()was already called on, the promise fulfills with a device that is immediately lost. You can then get information on how the device was lost via Lost.