webgpu.h implementations are allowed to require that all returned objects, except for WGPUInstance, can only be used from the thread they were created on, causing undefined behavior otherwise.
Where multithreading is supported:
Native (non-Wasm) implementations should support multithreading.
At the time of this writing, the JS WebGPU API is not multithreading-capable. Initial webgpu.h implementations will not be multithreading-capable.
Wasm-on-JS implementations may implement multithreading by proxying calls to a single JS "thread", as long as the C API behavior is conformant.
Once the JS API is multithreading-capable, there are still expected to be some thread-local behaviors:
webgpu.h in general). (In Rust terms, shareable = Send+Sync, transferable = Send.)Finish() still must happen on the thread that created the encoder.)The webgpu.h API is thread-safe (when multithreading is supported). That is, its functions are reentrant and may be called during the execution of other functions, with the following exceptions:
The following are thread safe: