pub struct Device { /* private fields */ }Expand description
A WebGPU device that renderers on any thread share: the library’s, or the host’s. Clones share it.
Implementations§
Source§impl Device
impl Device
Sourcepub fn new(adapter_index: Option<usize>) -> Result<Device, Error>
pub fn new(adapter_index: Option<usize>) -> Result<Device, Error>
The library’s device, on the adapter at adapter_index in
wgpu::Instance::enumerate_adapters order, or on the
high-performance adapter when None. Its uncaptured errors are
logged.
Fails with ErrorKind::NotFound when there is
no adapter at adapter_index, with
ErrorKind::Unsupported when there is no
adapter at all, and with ErrorKind::Native
when the adapter can’t create the device.
Sourcepub fn from_wgpu(
instance: Option<Instance>,
device: Device,
queue: Queue,
surface_format: Option<TextureFormat>,
) -> Device
pub fn from_wgpu( instance: Option<Instance>, device: Device, queue: Queue, surface_format: Option<TextureFormat>, ) -> Device
The host’s device and queue. Window surfaces need the instance that
made the device. A surface is configured with surface_format, which
it must support, or else with a format it supports that is the first
of BGRA8 and RGBA8 for the device’s adapter. The host keeps the
device’s uncaptured-error handler.
pub fn device(&self) -> &Device
pub fn queue(&self) -> &Queue
pub fn instance(&self) -> Option<&Instance>
Sourcepub fn adapter_info(&self) -> AdapterInfo
pub fn adapter_info(&self) -> AdapterInfo
The adapter the device is on (name, backend, driver).