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: InstanceA 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
impl WGPUContext
pub fn new() -> Self
pub fn with_features_and_limits( extra_features: Option<Features>, override_limits: Option<Limits>, ) -> Self
Sourcepub async fn create_surface<'w>(
&mut self,
window: impl Into<SurfaceTarget<'w>>,
surface_config: SurfaceRendererConfiguration,
intermediate_texture_config: Option<TextureConfiguration>,
) -> Result<SurfaceRenderer<'w>, WgpuContextError>
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.
Sourcepub async fn create_buffer_renderer(
&mut self,
config: BufferRendererConfig,
) -> Result<BufferRenderer, WgpuContextError>
pub async fn create_buffer_renderer( &mut self, config: BufferRendererConfig, ) -> Result<BufferRenderer, WgpuContextError>
Creates a new BufferRenderer for the specified dimensions.
Sourcepub async fn find_or_create_device(
&mut self,
compatible_surface: Option<&Surface<'_>>,
) -> Result<usize, WgpuContextError>
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§
Auto Trait Implementations§
impl Freeze for WGPUContext
impl !RefUnwindSafe for WGPUContext
impl Send for WGPUContext
impl Sync for WGPUContext
impl Unpin for WGPUContext
impl !UnwindSafe for WGPUContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more