Device

Struct Device 

Source
pub struct Device {
    pub wgpu: Device,
    pub queue: Queue,
    pub surface: Option<Surface>,
    /* private fields */
}

Fields§

§wgpu: Device§queue: Queue§surface: Option<Surface>

Implementations§

Source§

impl Device

Source

pub async fn for_surface( surface: Surface, adapter: &Adapter, ) -> Result<Self, RequestDeviceError>

Source

pub async fn offscreen(adapter: &Adapter) -> Result<Self, RequestDeviceError>

Source

pub const fn device(&self) -> &Device

Source

pub const fn size(&self) -> Size<u32, Pixels>

Source

pub fn device_mut(&mut self) -> &mut Device

Source

pub fn create_command_encoder(&self) -> CommandEncoder

Source

pub fn configure<PM: Into<PresentMode>>( &mut self, size: Size<u32, ScreenSpace>, mode: PM, format: TextureFormat, )

Source

pub fn create_pipeline_layout(&self, ss: &[Set<'_>]) -> PipelineLayout

Source

pub fn create_shader(&self, source: &[u8]) -> Shader

Source

pub fn create_shader_from_wgsl(&self, source: &str) -> Shader

Source

pub fn create_encoder(&self) -> CommandEncoder

Source

pub fn create_texture( &self, size: Size<u32, ScreenSpace>, format: TextureFormat, usage: TextureUsages, sample_count: u32, ) -> Texture

Source

pub fn create_framebuffer( &self, size: Size<u32, ScreenSpace>, format: TextureFormat, sample_count: u32, ) -> Framebuffer

Source

pub fn create_zbuffer( &self, size: Size<u32, ScreenSpace>, sample_count: u32, ) -> DepthBuffer

Source

pub fn create_binding_group( &self, layout: &BindingGroupLayout, binds: &[&dyn Bind], ) -> BindingGroup

Source

pub fn create_buffer<T>(&self, vertices: &[T]) -> VertexBuffer
where T: 'static + Copy + Pod,

Source

pub fn create_uniform_buffer<T>(&self, buf: &[T]) -> UniformBuffer
where T: Pod + 'static + Copy,

Source

pub fn create_index(&self, indices: &[u16]) -> IndexBuffer

Source

pub fn create_sampler( &self, min_filter: FilterMode, mag_filter: FilterMode, ) -> Sampler

Source

pub fn create_binding_group_layout( &self, index: u32, slots: &[Binding], ) -> BindingGroupLayout

Source

pub fn create_buffer_from_slice<T: Pod>( &self, slice: &[T], usage: BufferUsages, ) -> Buffer

Source

pub fn update_uniform_buffer<T: Pod + Copy + 'static>( &self, slice: &[T], buf: &UniformBuffer, )

Source

pub fn submit<I: IntoIterator<Item = CommandBuffer>>( &mut self, cmds: I, ) -> SubmissionIndex

Source

pub fn create_pipeline( &self, pipeline_layout: PipelineLayout, vertex_layout: VertexLayout, blending: Blending, vs: &Shader, fs: &Shader, swapchain_format: TextureFormat, multisample: MultisampleState, ) -> Pipeline

Trait Implementations§

Source§

impl Debug for Device

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Device

§

impl !RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl !UnwindSafe 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>