Module gpu_resources

Source
Expand description

Asynchronous GPU resource acquisition for rendering with wgpu.

To support WebGPU on WASM, the GPU resources need to be acquired asynchronously because the wgpu library provides only asynchronous methods for requesting adapters and devices. In WASM, blocking the main thread is not an option, as the JavaScript execution model does not support thread blocking. Consequently, we must use asynchronous execution (via wasm_bindgen_futures) to handle these operations.

Based on a code snippet by Luke Petherbridge.

Structs§

GpuResources
The acquired GPU resources needed for rendering with wgpu.

Enums§

GpuResourceError
Possible errors during GPU resource setup.

Functions§

spawn
Spawns a future for execution, adapting to the target environment.