[][src]Function emu_core::pool::take

pub fn take<'a>() -> Result<&'a Mutex<Device>, NoDeviceError>

Takes the device currently selected out of the device pool and hands you a mutex for mutating the device's sate

This function is the link between the high-level pool-based interface and the low-level WebGPU internals. With take, you can mutate the WebGPU internals "hidden" behind the device pool. Consequently, you can have full control over each device in the pool if you want or use high-level get/set/compile/spawn.

futures::executor::block_on(assert_device_pool_initialized());
let mut d = take()?.lock()?;
let pi: DeviceBox<f32> = d.create_with_size(std::mem::size_of::<f32>());