-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async API #598
Async API #598
Conversation
Ready. This basically applies the API changes to move further with async support. Next up would be creating examples that use the API in an async setting with asyncio and trio. Another further step could be to change the implementation of wgpu-native so that using the async api actually helps performance. But I'll probably leave that for later. This PR also prepares the way for implementing update propagation, taking async and portability into account. |
See #391, also relates to pygfx/pygfx#495
Introduction
This PR changes the API to expose the async methods and their sync (convenience) variants. This does not implement any of the async stuff at the level of wgpu-native (the async methods simply call the sync variant for now). That's for another PR. This does however, make it possible to look into using wgpu-py in an async setting.
In short
Promise
), all get a_async
suffix in wgpu-py._sync
suffix in wgpu-py. This way, they are easily identified, to detect less portable code.Affected methods
gpu.request_adapter()
gpu.enumerate_adapters()
adapter.request_device()
buffer.map()
device.lost
(but was not yet implemented)shadermodule.get_compilation_info()
(but was not yet implemented)queue.on_submitted_work_done()
(but was not yet implemented)These method also have (and already had) an async variant:
create_compute_pipeline()
create_render_pipeline()
Todo
_sync
version.API changes
gpu.request_adapter
is deprecated,request_adapter_sync
instead.gpu.enumerate_adapters
is deprecated, useenumerate_adapters_sync
instead.adapter.request_device
is deprecated, userequest_device_sync
instead.buffer.map
is deprecated, usemap_sync
instead.