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

Skip to content

Conversation

kainino0x
Copy link
Contributor

@kainino0x kainino0x commented Dec 17, 2019

The GPU.onadapteradded event fires when a new adapter is available.
Handling this is optional.
If the application was previously unable to initialize WebGPU,
this is its chance to do so.
If it is already running, it may choose to look through the new
adapters to see if it wants to switch to one of them.


Preview | Diff

should never trigger multiple competing signals,
so it is safe to handle each such signal individually.
(For example, a system event may trigger multiple {{GPUDevice/lost}} signals,
but not both {{GPU/adapteradded}} and {{GPUDevice/lost}}.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a reboot of an external GPU a single event or two?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. It would have to be two: adapter loss and adapter added. We would at least need to ensure those events arrive in order.

Even if these are spaced far enough apart that they don't collide, there is a problem: when the adapter comes back, if a promise from getAdapter() is still waiting (e.g. because it's waiting for the reset to finish), then there will be two signals: adapteradded and the resolution of the promise.

Copy link
Contributor Author

@kainino0x kainino0x Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#524 (comment) may solve this [EDIT: don't think so]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way to handle this: don't fire adapteradded on device resets. If an app did requestAdapters() after a device reset it would see a new GPUAdapter object, but it would not be a different physical device so it doesn't actually care.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, as one TODO in the doc says, I don't think there's a reason to actually lose the adapter on reset. We can just lose all the devices on the adapter without replacing the adapter itself. So then there is no reason to expect adapteradded would fire anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@Kangz
Copy link
Contributor

Kangz commented Jan 6, 2020

This was discussed in the 2020-01-06 meeting

@kainino0x
Copy link
Contributor Author

Resolution: further consider onadapterschanged

@kainino0x kainino0x closed this Mar 16, 2020
@kainino0x kainino0x deleted the adapteradded branch August 28, 2021 01:43
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants