Skip to main content

Device

Struct Device 

Source
pub struct Device { /* private fields */ }
Expand description

a logical GPU device: creates resources, records commands, owns the queue

Implementations§

Source§

impl Device

Source

pub fn encoder(&self) -> Result<CommandEncoder<'_>>

a command encoder (a recording command buffer)

Source§

impl Device

Source

pub fn queue(&self) -> &Queue

Source

pub fn info(&self) -> &AdapterInfo

Source

pub fn features(&self) -> &Features

what this device has enabled

Source

pub fn limits(&self) -> &Limits

Source

pub fn level(&self) -> Level

Source

pub fn is_lost(&self) -> bool

the device was lost: every call fails with DeviceLost; create a new device

Source

pub fn test_lose(&self)

(test aid) behave as a lost device from now on (a lost device runs nothing any more and its resources may go at once; here the GPU may still work on the last submission: it finishes first)

Source

pub fn validating(&self) -> bool

the validation layer watches this device

Source

pub fn poll(&self) -> Result<()>

free what the GPU has finished with (also done by submit and wait)

Source

pub fn wait(&self, id: SubmitId, timeout_ns: u64) -> Result<bool>

wait for a submission -> false when timeout_ns passed first

Source

pub fn wait_idle(&self) -> Result<()>

wait for every submission so far

Source

pub fn completed(&self) -> SubmitId

the last submission the GPU has finished

Source

pub fn is_done(&self, id: SubmitId) -> bool

the submission id is done on the GPU (asks the driver; never waits)

Source

pub fn memory_reserved(&self) -> u64

bytes of device and host memory the device holds in blocks

Source§

impl Device

Source

pub fn create_buffer(&self, desc: &BufferDesc) -> Result<Buffer>

Source§

impl Device

Source§

impl Device

Source§

impl Device

Source§

impl Device

Source§

impl Device

Source§

impl Device

Source§

impl Device

Source

pub fn create_compute_pipeline( &self, desc: &ComputePipelineDesc<'_>, ) -> Result<ComputePipeline>

Source

pub fn create_compute_pipeline_sized( &self, desc: &ComputePipelineDesc<'_>, size: u32, ) -> Result<ComputePipeline>

create_compute_pipeline with a required subgroup size (WGSL @subgroup_size, what wgsl::Output::subgroup_size returns): Features::subgroup_size_control, a power of two in Limits::subgroup_min_size ..= subgroup_max_size; size 0: the driver’s choice

Source

pub fn create_render_pipeline( &self, desc: &RenderPipelineDesc<'_>, ) -> Result<RenderPipeline>

Source§

impl Device

Source

pub fn create_timestamps(&self, count: u32) -> Result<Timestamps>

Source§

impl Device

Source

pub fn create_swapchain( &self, surface: &Surface, desc: &SwapchainDesc, ) -> Result<Swapchain>

Trait Implementations§

Source§

impl Clone for Device

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Device

§

impl !UnwindSafe for Device

§

impl Forget for Device

§

impl Freeze for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl UnsafeUnpin for Device

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<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> 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.