Skip to content

Commit

Permalink
Replace previous normalized device identifiers definition with a rail…
Browse files Browse the repository at this point in the history
…road diagram
  • Loading branch information
toji committed Apr 11, 2022
1 parent b0a6987 commit 8091786
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions spec/index.bs
Expand Up @@ -1486,21 +1486,21 @@ interface 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$].
[=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$].
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$]
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$].
reasonable approximation of the architecture as a [=normalized identifier string=].

1. If |unmaskedValues| [=set/contains=] `"deviceId"` and the deviceId is known:
1. Set |adapterInfo|.{{GPUAdapterInfo/deviceId}} to a vendor-specific numeric ID for
Expand All @@ -1524,14 +1524,22 @@ interface GPUAdapterInfo {
</div>

<div algorithm>
To generate a <dfn abstract-op>normalized identifier string</dfn> for a given {{DOMString}}
|identifier|, run the following steps:

1. Let |normalized| be a copy of |identifier|.
1. Remove any non-ASCII characters from |normalized|.
1. Convert |normalized| to lowercase.
1. Replace any spaces in |normalized| with a hyphen character. (`"-"`)
1. Return |normalized|.
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`
- `next-gen`
- `series-x20-ultra`
</div>
</div>

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

0 comments on commit 8091786

Please sign in to comment.