@@ -1312,16 +1312,15 @@ WebGPU on top of that functionality.
13121312calling {{GPU/requestAdapter()}} multiple times returns a different [=adapter=]
13131313object each time.
13141314
1315- An [=adapter=] object may become [=invalid=] at any time.
1316- This happens inside "[=lose the device=]" and "[=mark adapters stale=]" .
1317- An invalid adapter is unable to vend new [=devices=] .
1315+ Each [=adapter=] object can only be used to create one [=device=]:
1316+ upon a successful {{GPUAdapter/requestDevice()}}, the adapter becomes [=invalid=] .
1317+ Additionally, [= adapter=] objects may [=adapter/expire=] at any time .
13181318
13191319Note:
1320- This mechanism ensures that various adapter-creation scenarios look similar to applications,
1321- so they can easily be robust to more scenarios with less testing : first initialization,
1320+ This ensures applications use the latest system state for adapter selection when creating a device.
1321+ It also encourages robustness to more scenarios by making them look similar : first initialization,
13221322reinitialization due to an unplugged adapter, reinitialization due to a test
1323- {{GPUDevice/destroy()|GPUDevice.destroy()}} call, etc. It also ensures applications use
1324- the latest system state to make decisions about which adapter to use.
1323+ {{GPUDevice/destroy()|GPUDevice.destroy()}} call, etc.
13251324
13261325An [=adapter=] may be considered a <dfn>fallback adapter</dfn> if it has significant performance
13271326caveats in exchange for some combination of wider compatibility, more predictable behavior, or
@@ -1411,7 +1410,6 @@ the device **should** be lost to prevent these changes from being observable.
14111410<div algorithm data-timeline=device>
14121411 To <dfn dfn>lose the device</dfn>(|device|, |reason|):
14131412
1414- 1. Make |device|.{{device/[[adapter]]}} [=invalid=].
14151413 1. Make |device| [=invalid=].
14161414 1. Let |gpuDevice| be the [=content timeline=] {{GPUDevice}} corresponding to |device|.
14171415
@@ -2309,37 +2307,20 @@ interface GPU {
23092307 </div>
23102308</dl>
23112309
2312- {{GPU}} has the following internal slots:
2313-
2314- <dl dfn-type=attribute dfn-for=GPU>
2315- : <dfn>\[[previously_returned_adapters]]</dfn>, of type [=ordered set=]<[=adapter=]>
2316- ::
2317- The set of [=adapters=] that have been returned via {{GPU/requestAdapter()}}.
2318- It is used, then cleared, in [=mark adapters stale=].
2319- </dl>
2320-
2310+ [=Adapters=] **may** become [=invalid=] ("<dfn dfn for=adapter>expire</dfn>") at any time.
23212311Upon any change in the system's state that could affect the result of any {{GPU/requestAdapter()}}
2322- call, the user agent *should* [=mark adapters stale=] . For example:
2312+ call, the user agent ** should** expire all previously-returned adapters . For example:
23232313
2324- - A physical adapter is added/removed (via plug, driver update, TDR , etc.)
2314+ - A physical adapter is added/removed (via plug/unplug , driver update, hang recovery , etc.)
23252315- The system's power configuration has changed (laptop unplugged, power settings changed, etc.)
23262316
2327- Additionally, [=mark adapters stale=] may by scheduled at any time.
2328- User agents may choose to do this often even when there has been no system state change (e.g.
2329- several seconds after the last call to {{GPUAdapter/requestDevice()}}.
2330- This has no effect on well-formed applications, obfuscates real system state changes, and makes
2331- developers more aware that calling {{GPU/requestAdapter()}} again is always necessary before
2332- calling {{GPUAdapter/requestDevice()}}.
2333-
2334- <div algorithm>
2335- To <dfn dfn>mark adapters stale</dfn>:
2336-
2337- 1. For each |adapter| in `navigator.gpu.`{{GPU/[[previously_returned_adapters]]}}:
2338- 1. Make |adapter|.{{GPUAdapter/[[adapter]]}} [=invalid=].
2339- 1. [=list/Empty=] `navigator.gpu.`{{GPU/[[previously_returned_adapters]]}}.
2340-
2341- <!-- POSTV1(adapterschanged event): update here -->
2342- </div>
2317+ Note:
2318+ User agenst may choose to [=adapter/expire=] adapters often, even when there has been no system
2319+ state change (e.g. seconds or minutes after the adapter was created).
2320+ This can help obfuscate real system state changes, and make developers more aware that calling
2321+ {{GPU/requestAdapter()}} again is always necessary before calling {{GPUAdapter/requestDevice()}}.
2322+ If an application does encounter this situation, standard device-loss recovery
2323+ handling should allow it to recover.
23432324
23442325<div class=example>
23452326 Requesting a {{GPUAdapter}} with no hints:
@@ -2533,6 +2514,9 @@ interface GPUAdapter {
25332514 ::
25342515 Requests a [=device=] from the [=adapter=].
25352516
2517+ This is a one-time action: if a device is returned successfully,
2518+ the adapter becomes [=invalid=].
2519+
25362520 <div algorithm=GPUAdapter.requestDevice>
25372521 <div data-timeline=content>
25382522 **Called on:** {{GPUAdapter}} |this|.
@@ -2617,6 +2601,7 @@ interface GPUAdapter {
26172601 Otherwise:
26182602
26192603 1. Let |device| be [=a new device=] with the capabilities described by |descriptor|.
2604+ 1. Make |adapter|.{{GPUAdapter/[[adapter]]}} [=invalid=].
26202605
26212606 1. Issue the subsequent steps on <var data-timeline=content>contentTimeline</var>.
26222607 </div>
0 commit comments