pub struct Renderer {
pub surface: Surface<'static>,
pub device: Device,
pub queue: Queue,
pub config: SurfaceConfiguration,
/* private fields */
}Fields§
§surface: Surface<'static>§device: Device§queue: Queue§config: SurfaceConfigurationImplementations§
Source§impl Renderer
impl Renderer
pub async fn new(window: &'static Window) -> Result<Self>
pub fn scale_factor(&self) -> f32
pub fn resize(&mut self, width: u32, height: u32)
pub fn resize_with_scale(&mut self, width: u32, height: u32, scale_factor: f32)
pub fn resize_with_logical_viewport( &mut self, surface_width: u32, surface_height: u32, scale_factor: f32, logical_width: u32, logical_height: u32, viewport_x: u32, viewport_y: u32, viewport_width: u32, viewport_height: u32, )
pub fn logical_size(&self) -> (u32, u32)
pub fn render_sprites( &mut self, images: &ImageManager, sprites: &[RenderSprite], ) -> Result<()>
pub fn debug_read_render_chain_textures( &self, ) -> Result<Vec<RendererDebugTexture>>
Sourcepub fn clear_runtime_image_textures(&mut self)
pub fn clear_runtime_image_textures(&mut self)
Drop GPU textures that are keyed by runtime ImageId.
Scene restart reinitializes ImageManager and reuses ImageId indices from 0. Keeping the old GPU cache would make a newly decoded image with the same ImageId/version sample the previous scene’s texture. External path based textures are intentionally kept because their keys are stable resource paths.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Renderer
impl !RefUnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl UnsafeUnpin for Renderer
impl !UnwindSafe for Renderer
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.