-
Notifications
You must be signed in to change notification settings - Fork 55
Closed as not planned
Labels
asyncAsynchronous operations and callbacksAsynchronous operations and callbacks
Description
Currently in Dawn, we have to call device.Tick() repetitively in order to make progress and receive callbacks. If there are any pending callbacks, they're resolved on the same thread that you call Tick(). We've been thinking about removing Tick and checking callback completion on a separate thread. This has opened up a couple of possible ways forward, and we should have the behavior consistent for users of webgpu.h
1. Use Tick
- Calling this in a loop is particularly wasteful.
- It's easy to misuse -- calling it often all the time or not at all
- It isn't part of the JavaScript API.
- It does however let the application most explicitly control when callbacks are delivered
- May require an application to do their own cross-thread posting if they want to process the callback somewhere else
2. Call callbacks on a separate thread
- May require an application to do their own cross-thread posting if they want to process the callback somewhere else
- The application receives the callback on a thread it didn't create -- exposing an implementation detail
3. Forward callbacks to the originating thread
- May require an application to do their own cross-thread posting if they want to process the callback somewhere else
- Requires the implementation to check at every / most API calls if there's a callback to process
- This is probably where an application wants to receive a callback, so it's nice if we do it for them.
I lean toward option (2). Having (1) is a fairly inefficient solution. I don't want to have the implementation do extra work to implement (3), especially if an application already manages cross-thread tasks itself.
Metadata
Metadata
Assignees
Labels
asyncAsynchronous operations and callbacksAsynchronous operations and callbacks