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

Source§

impl Device

Source

pub fn queue(&self) -> &Queue

Source

pub fn info(&self) -> &AdapterInfo

Source

pub fn features(&self) -> &Features

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) the device is destroyed: the browser’s own way of losing it

Source

pub fn validating(&self) -> bool

Source

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

what the browser has said since the last look (nothing to free here)

Source

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

the browser cannot wait on this thread: at once whether the submission is done

Source

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

Source

pub fn completed(&self) -> SubmitId

Source

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

the submission id is done on the GPU (the browser’s answer comes with its event loop)

Source

pub fn memory_reserved(&self) -> u64

what the buffers and textures asked for (the browser says nothing about its own memory)

Source§

impl Device

Source

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

Source§

impl Device

Source§

impl Device

Source

pub fn create_bind_group_layout( &self, bindings: &[Binding], ) -> Result<BindGroupLayout>

Source

pub fn create_pipeline_layout( &self, desc: &PipelineLayoutDesc<'_>, ) -> Result<PipelineLayout>

groups: at most BIND_GROUPS_MAX, and with push constants at most 3 (the last is theirs)

Source

pub fn create_bind_group(&self, desc: &BindGroupDesc<'_>) -> Result<BindGroup>

Source

pub fn create_bindless(&self, _desc: &BindlessDesc) -> Result<Bindless>

(level Voll)

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>

(a required subgroup size: not built in the browser; size 0 is the plain pipeline)

Source

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

Source

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

(not built in the browser: Features::timestamps is false; WebGPU has them only at the start and the end of a pass)

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 !Send for Device

§

impl !Sync for Device

§

impl !UnwindSafe for Device

§

impl Forget for Device

§

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