Skip to main content

DeviceHandle

Struct DeviceHandle 

Source
pub struct DeviceHandle {
    pub adapter: Adapter,
    pub device: Device,
    pub queue: Queue,
    pub caps: TierCaps,
    /* private fields */
}
Expand description

A logical device, the adapter it was created from, the queue that executes its command buffers, and the capabilities that adapter reported.

Cheap to clone: wgpu’s Adapter/Device/Queue are all Arc-backed handles to one underlying object, so a clone is another handle to the same device rather than a second device. Clone it freely to hand a subsystem the device it needs instead of threading a &RenderContext borrow through it.

Fields§

§adapter: Adapter

The adapter the device was created from.

§device: Device

The logical device.

§queue: Queue

The queue that executes this device’s command buffers.

§caps: TierCaps

What Self::adapter reported at device-creation time. Captured once so downstream pipeline/atlas decisions read plain data instead of re-probing the adapter.

Implementations§

Source§

impl DeviceHandle

Source

pub fn first_uncaptured_error(&self) -> Option<&str>

The first uncaptured wgpu error this device ever raised, or None if it has raised none.

Latched, never overwritten: a frame loop polling this wants the error that started the trouble, not the last one in a storm the first one caused. It is also the only programmatic view of an uncaptured error a caller gets — the handler otherwise only logs (see decide_log_action) — so a host can degrade or report instead of silently rendering nothing every frame.

Deliberately not clearable: “this device has seen an uncaptured error” is a property of the device, and a device that has raised one is not reliably recoverable by forgetting about it.

Trait Implementations§

Source§

impl BufferUploader for DeviceHandle

Source§

type Buffer = Buffer

The created buffer — wgpu::Buffer in production.
Source§

fn allocate_buffer( &self, label: Option<&str>, size: u64, usage: BufferUsages, ) -> Buffer

Creates an uninitialized buffer of size bytes with usage.
Source§

fn write_buffer(&self, buffer: &Buffer, offset: u64, bytes: &[u8])

Copies bytes into buffer at offset.
Source§

impl Clone for DeviceHandle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,