pub struct WgpuContext {
pub window: Arc<Window>,
pub surface: Surface<'static>,
pub device: Device,
pub queue: Queue,
pub config: SurfaceConfiguration,
/* private fields */
}Expand description
WgpuContext stores all wgpu-related state for a single window application, including the device, queue, surface, surface configuration, and the window itself.
Fields§
§window: Arc<Window>§surface: Surface<'static>§device: Device§queue: Queue§config: SurfaceConfigurationImplementations§
Source§impl WgpuContext
impl WgpuContext
pub fn new(window: Arc<Window>) -> WumeResult<Self>
pub fn resize(&mut self, width: u32, height: u32)
pub fn is_surface_configured(&self) -> bool
Sourcepub fn simple_frame<F>(&mut self, clear_color: Color, render_fn: F)where
F: FnOnce(&mut RenderPass<'_>),
pub fn simple_frame<F>(&mut self, clear_color: Color, render_fn: F)where
F: FnOnce(&mut RenderPass<'_>),
Sets up a simple render pass on the main surface with the given clear color, and calls the provided closure to perform rendering commands.
Auto Trait Implementations§
impl !Freeze for WgpuContext
impl !RefUnwindSafe for WgpuContext
impl !UnwindSafe for WgpuContext
impl Send for WgpuContext
impl Sync for WgpuContext
impl Unpin for WgpuContext
impl UnsafeUnpin 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.