Skip to content

Why is Adapter::request_device() randomly using Futures? #5573

Answered by kpreid
AshtonSnapp asked this question in Q&A
Discussion options

You must be logged in to vote

Of which I have no easy way of dealing with other than making a RawWaker, wrapping it in a Waker, wrapping that in a Context, and giving that to the poll method of the pinned future.

You do not need to deal with raw wakers yourself; pollster neatly wraps all that up into an absolutely minimal but complete implementation of blocking on a Future.

why did you do this?

One of the primary purposes of wgpu is to be WebGPU — both an implementation of WebGPU, and an interface to the WebGPU API in browsers — and for that purpose, not just request_device(), but everything that retrieves information from the GPU or OS is asynchronous (though not necessarily async). The only blocking call anywher…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AshtonSnapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants