Skip to main content

oxide_renderer/
device.rs

1//! Device and Queue creation
2
3use wgpu::{Device, DeviceDescriptor, ExperimentalFeatures, Features, Limits, Queue};
4
5pub struct DeviceQueue {
6    pub device: Device,
7    pub queue: Queue,
8}
9
10pub async fn request_device(
11    adapter: &wgpu::Adapter,
12) -> Result<DeviceQueue, wgpu::RequestDeviceError> {
13    let (device, queue) = adapter
14        .request_device(&DeviceDescriptor {
15            label: Some("Oxide Core Device"),
16            required_features: Features::empty(),
17            required_limits: Limits::default(),
18            memory_hints: Default::default(),
19            trace: Default::default(),
20            experimental_features: ExperimentalFeatures::disabled(),
21        })
22        .await?;
23
24    Ok(DeviceQueue { device, queue })
25}