Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Merge branch 'main' into extensions
  • Loading branch information
kainino0x committed Jun 29, 2022
commit 16af7971ad75e134dc623a716e3c733f6d074f18
117 changes: 117 additions & 0 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,123 @@ but which the user agent has not been updated to recognize yet. If the [=set ent
</div>
</div>

#### <dfn interface>GPUAdapterInfo</dfn> #### {#gpu-adapterinfo}

{{GPUAdapterInfo}} exposes various identifying information about an adapter.

None of the members in {{GPUAdapterInfo}} are guaranteed to be populated. It is at the user
agent's discretion which values to reveal, and it is likely that on some devices none of the values
will be populated. As such, applications **must** be able to handle any possible {{GPUAdapterInfo}} values,
including the absence of those values.

<script type=idl>
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUAdapterInfo {
readonly attribute DOMString vendor;
readonly attribute DOMString architecture;
readonly attribute DOMString device;
readonly attribute DOMString description;
};
</script>

{{GPUAdapterInfo}} has the following attributes:

<dl dfn-type=attribute dfn-for=GPUAdapterInfo>
: <dfn>vendor</dfn>
::
The name of the vendor of the [=adapter=], if available. Empty string otherwise.

: <dfn>architecture</dfn>
::
The name of the family or class of GPUs the [=adapter=] belongs to, if available. Empty
string otherwise.

: <dfn>device</dfn>
::
A vendor-specific identifier for the [=adapter=], if available. Empty string otherwise.

Note: This is a value that represents the type of adapter. For example, it may be a
[PCI device ID](https://pcisig.com/). It does not uniquely identify a given piece of
hardware like a serial number.

: <dfn>description</dfn>
::
A human readable string describing the [=adapter=] as reported by the driver, if available.
Empty string otherwise.

Note: Because no formatting is applied to {{GPUAdapterInfo/description}} attempting to parse
this value is not recommended. Applications which change their behavior based on the
{{GPUAdapterInfo}}, such as applying workarounds for known driver issues, should rely on the
other fields when possible.

</dl>

<div algorithm>
To create a <dfn abstract-op>new adapter info</dfn> for a given [=adapter=] |adapter|, run the
following steps:

1. Let |adapterInfo| be a new {{GPUAdapterInfo}}.
1. Let |unmaskedValues| be |adapter|.{{adapter/[[unmaskedIdentifiers]]}}
1. If |unmaskedValues| [=set/contains=] `"vendor"` and the vendor is known:
1. Set |adapterInfo|.{{GPUAdapterInfo/vendor}} to the name of |adapter|'s vendor as a
[=normalized identifier string=].

Otherwise:

1. Set |adapterInfo|.{{GPUAdapterInfo/vendor}} to the empty string or a
reasonable approximation of the vendor as a [=normalized identifier string=].

1. If |unmaskedValues| [=set/contains=] `"architecture"` and the architecture is known:
1. Set |adapterInfo|.{{GPUAdapterInfo/architecture}} to a [=normalized identifier string=]
representing the family or class of adapters to which |adapter| belongs.

Otherwise:

1. Set |adapterInfo|.{{GPUAdapterInfo/architecture}} to the empty string or a
reasonable approximation of the architecture as a [=normalized identifier string=].

1. If |unmaskedValues| [=set/contains=] `"device"` and the device is known:
1. Set |adapterInfo|.{{GPUAdapterInfo/device}} to a [=normalized identifier string=]
representing a vendor-specific identifier for |adapter|.

Otherwise:

1. Set |adapterInfo|.{{GPUAdapterInfo/device}} to to the empty string or a
reasonable approximation of a vendor-specific identifier as a [=normalized identifier
string=].

1. If |unmaskedValues| [=set/contains=] `"description"` and a description is known:
1. Set |adapterInfo|.{{GPUAdapterInfo/description}} to a description of the |adapter| as
reported by the driver.

Otherwise:

1. Set |adapterInfo|.{{GPUAdapterInfo/description}} to the empty string or a
reasonable approximation of a description.

1. Return |adapterInfo|.
</div>

<div algorithm>
A <dfn>normalized identifier string</dfn> is one that follows the following pattern:

<pre class='railroad'>
OneOrMore:
OneOrMore:
T: a-z 0-9
T: -
</pre>

<div class="example">
Examples of valid normalized identifier strings include:
- `gpu`
- `3d`
- `0x3b2f`
- `next-gen`
- `series-x20-ultra`
</div>
</div>

## Extension Documents ## {#extension-documents}

"Extension Documents" are additional documents which describe new functionality which is
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.