[−][src]Function emu_core::pool::pool
pub fn pool(
new_device_pool: Vec<DevicePoolMember>
) -> Result<(), PoolAlreadyInitializedError>
Sets the device pool to the given Vec
of devices
You can use pool
to set up a custom pool of devices. It can only be successfully called just once. Calling pool
multiple times will result in a panic at runtime.
let mut device = futures::executor::block_on(Device::all()).remove(0); pool(vec![DevicePoolMember { device: Mutex::new(device), device_info: None }])?; // technically, we don't need this assertion because we know the pool is initialized futures::executor::block_on(assert_device_pool_initialized()); let pi: DeviceBox<f32> = DeviceBox::with_size(std::mem::size_of::<f32>())?;
This function can be useful if you want to work with the WebGPU internals with take
.
You can call pool
at the start of your application to initialize all the devices you plan on using.
You can then do graphics stuff using take
and all of wgpu-rs
and compute stuff with high-level get
/set
/compile
/spawn
.