WGPUContext

Struct WGPUContext 

Source
pub struct WGPUContext {
    pub instance: Instance,
    pub device_pool: Vec<DeviceHandle>,
    /* private fields */
}
Expand description

Simple render context that maintains wgpu state for rendering the pipeline.

Fields§

§instance: Instance

A WGPU Instance. This only needs to be created once per application.

§device_pool: Vec<DeviceHandle>

A pool of already-created devices so that we can avoid recreating devices when we already have a suitable one available

Implementations§

Source§

impl WGPUContext

Source

pub fn new() -> Self

Source

pub fn with_features_and_limits( extra_features: Option<Features>, override_limits: Option<Limits>, ) -> Self

Source

pub async fn create_surface<'w>( &mut self, window: impl Into<SurfaceTarget<'w>>, surface_config: SurfaceRendererConfiguration, intermediate_texture_config: Option<TextureConfiguration>, ) -> Result<SurfaceRenderer<'w>, WgpuContextError>

Creates a new surface for the specified window and dimensions.

Source

pub async fn create_buffer_renderer( &mut self, config: BufferRendererConfig, ) -> Result<BufferRenderer, WgpuContextError>

Creates a new BufferRenderer for the specified dimensions.

Source

pub async fn find_or_create_device( &mut self, compatible_surface: Option<&Surface<'_>>, ) -> Result<usize, WgpuContextError>

Finds or creates a compatible device handle id.

Trait Implementations§

Source§

impl Default for WGPUContext

Source§

fn default() -> Self

Returns the “default value” for a type. 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<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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

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