Skip to main content

Module drv

Module drv 

Source
Expand description

Host-bound WebGPU adapter registration.

WebGPU has no synchronous enumeration. navigator.gpu.requestAdapter() and GPUAdapter.requestDevice() both return promises, and Backend is a synchronous trait — so this crate cannot negotiate an adapter itself without blocking, which is not permitted on a browser’s main thread.

The host therefore does the async negotiation and registers the result with bind_adapter. Everything downstream — enumerate, the Backend impl, Runtime::devices() — reads what was bound. Until a host binds, the backend honestly reports unavailable.

Structs§

AdapterInfo
What a host learned about its adapter, in WebGPU’s own vocabulary.

Functions§

bind_adapter
Register the adapter this host negotiated. Replaces any previous binding.
bound_adapter
The currently bound adapter, if any.
enumerate
The bound adapter as a one-element list, or empty. WebGPU exposes exactly one adapter per requestAdapter call; there is no multi-device survey.
is_available
Whether a host has bound an adapter.
unbind_adapter
Drop the current binding. After this the backend reports unavailable again.