这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 187 additions & 11 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,30 @@ coordinating with GPU vendors and implementing workarounds for known issues in t

### Adapter Identifiers ### {#privacy-adapter-identifiers}

Issue: Describe considerations for exposing adapter info
Past experience with WebGL has demonstrated that developers have a legitimate need to be able to
identify the GPU their code is running on in order to create and maintain robust GPU-based content.
For example, to identify adapters with known driver bugs in order to work around them or to avoid
features that perform more poorly than expected on a given class of hardware.

Note: It is expected that WebGPU will expose some level of information identifying the type of GPU
Adapter in use. This is a potential source of fingerprinting information but past experience with
WebGL has demonstrated that it is necessary to some degree in order to enable developers to create
robust applications and respond effectively to user issues.
But exposing adapter identifiers also naturally expands the amount of fingerprinting information
available, so there's a desire to limit the precision with which we identify the adapter.

There are several mitigations that can be applied to strike a balance between enabling robust
content and preserving privacy. First is that user agents can reduce the burden on developers by
identifying and working around known driver issues, as they have since browsers began making use of
GPUs.

When adapter identifiers are exposed by default they should be as broad as possible while still
being useful. Possibly identifying, for example, the adapter's vendor and general architecture
without identifying the specific adapter in use. Similarly, in some cases identifiers for an adapter
that is considered a reasonable proxy for the actual adapter may be reported.

In cases where full and detailed information about the adapter is useful (for example: when filing
bug reports) the user can be asked for consent to reveal additional information about their hardware
to the page.

Finally, the user agent will always have the discretion to not report adapter identifiers at all if
it considers it appropriate, such as in enhanced privacy modes.

# Fundamentals # {#fundamentals}

Expand Down Expand Up @@ -1100,6 +1118,12 @@ An [=adapter=] has the following internal slots:
: <dfn>\[[fallback]]</dfn>, of type boolean
::
If set to `true` indicates that the adapter is a [=fallback adapter=].

: <dfn>\[[unmaskedIdentifiers]]</dfn>, of type [=ordered set=]&lt;{{DOMString}}&gt;
::
A list of names of {{GPUAdapterInfo}} fields the user agent has chosen to report for this
adapter. Initially populated with the names of any {{GPUAdapterInfo}} fields the user agent
has chosen to report without user consent.
</dl>

[=Adapters=] are exposed via {{GPUAdapter}}.
Expand Down Expand Up @@ -1502,6 +1526,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 avaliable. Empty string otherwise.

: <dfn>architecture</dfn>
::
The name of the family or class of GPUs the [=adapter=] belongs to, if avaliable. 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 avaliable.
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 to a [=normalized identifier string=]
reprenting a vendor-specific indetifier for |adapter|.

Otherwise:

1. Set |adapterInfo|.{{GPUAdapterInfo/device}} to to the empty string or a
reasonable approximation of a vendor-specific indetifier 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>

## Origin Restrictions ## {#origin-restrictions}

WebGPU allows accessing image data stored in images, videos, and canvases.
Expand Down Expand Up @@ -1777,23 +1918,18 @@ To get a {{GPUAdapter}}, use {{GPU/requestAdapter()}}.
<script type=idl>
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUAdapter {
readonly attribute DOMString name;
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
readonly attribute boolean isFallbackAdapter;

Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
};
</script>

{{GPUAdapter}} has the following attributes:

<dl dfn-type=attribute dfn-for=GPUAdapter>
: <dfn>name</dfn>
::
A human-readable name identifying the adapter.
The contents are implementation-defined.

: <dfn>features</dfn>
::
The set of values in `this`.{{GPUAdapter/[[adapter]]}}.{{adapter/[[features]]}}.
Expand Down Expand Up @@ -1887,6 +2023,46 @@ interface GPUAdapter {
1. Return |promise|.

</div>

: <dfn>requestAdapterInfo()</dfn>
::
Requests the {{GPUAdapterInfo}} for this {{GPUAdapter}}.

Note: Adapter info values are returned with a Promise to give user agents an
opportunity to perform potentially long-running checks when requesting unmasked values,
such as asking for user consent before returning. If no `unmaskHints` are specified,
however, no dialogs should be displayed to the user.

<div algorithm=GPUAdapter.requestAdapterInfo>
**Called on:** {{GPUAdapter}} |this|.

**Arguments:**
<pre class=argumentdef for="GPUAdapter/requestAdapterInfo()">
|unmaskHints|: A list of {{GPUAdapterInfo}} attribute names for which unmasked
values are desired if available.
</pre>

**Returns:** {{Promise}}&lt;{{GPUAdapterInfo}}&gt;

1. Let |promise| be [=a new promise=].
1. Let |adapter| be |this|.{{GPUAdapter/[[adapter]]}}.
1. Let |hasActivation| be `true` if the [=relevant global object=] for |this| has
[=transient activation=], and `false` otherwise.
1. Run the following steps [=in parallel=]:
1. If |unmaskHints|.length &gt; `0`:
1. If |hasActivation| is `false` [=reject=] |promise| with a {{NotAllowedError}}
and abort these steps.
1. Let |unmaskedKeys| be a [=list=] of the fields specified in |unmaskHints|
which the user agent decides to unmask, if any.

Note: The user agent is free to use any method it deems appropriate to
decide which fields to unmask.
1. [=set/Append=] |unmaskedKeys| to |adapter|.{{adapter/[[unmaskedIdentifiers]]}}.
1. [=Resolve=] |promise| with a [$new adapter info$] for |adapter|.

1. Return |promise|.

</div>
</dl>

<div class="example">
Expand Down