pub struct Renderer { /* private fields */ }Expand description
The renderer using instanced rendering.
This renderer converts FlattenedCommands into GPU instance data
and renders all shapes with a single draw call per layer.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub fn new(
device: Arc<Device>,
queue: Arc<Queue>,
format: TextureFormat,
) -> Self
pub fn new( device: Arc<Device>, queue: Arc<Queue>, format: TextureFormat, ) -> Self
Create a new renderer with instanced rendering.
Sourcepub fn set_screen_size(&mut self, width: f32, height: f32)
pub fn set_screen_size(&mut self, width: f32, height: f32)
Set the screen size in logical pixels.
Sourcepub fn set_scale_factor(&mut self, scale: f32)
pub fn set_scale_factor(&mut self, scale: f32)
Set the HiDPI scale factor.
Sourcepub fn render(
&mut self,
target: &mut RenderTarget,
frame: &FlatFrame<'_>,
clear_color: Color,
) -> bool
pub fn render( &mut self, target: &mut RenderTarget, frame: &FlatFrame<'_>, clear_color: Color, ) -> bool
Draw into whatever this surface points at, and hand it over.
false means nothing reached the target and the frame should be drawn
again — a lost or outdated swapchain, which is common right after a
resize. A texture cannot fail that way: it is already there.
Sourcepub fn render_to_view(
&mut self,
view: &TextureView,
width: u32,
height: u32,
frame: &FlatFrame<'_>,
clear_color: Color,
)
pub fn render_to_view( &mut self, view: &TextureView, width: u32, height: u32, frame: &FlatFrame<'_>, clear_color: Color, )
Render flattened commands into a texture view the caller owns.
This is everything render does once it holds a swapchain texture, with
the acquire and the present taken off both ends. A caller that has its
own target — an offscreen texture in a test, with no compositor and no
surface anywhere — gets the same pixels the screen would have shown.
width and height are the target’s size in physical pixels; the
backdrop targets are allocated against them.
Auto Trait Implementations§
impl !Freeze for Renderer
impl !RefUnwindSafe for Renderer
impl !Send for Renderer
impl !Sync for Renderer
impl !UnwindSafe for Renderer
impl Unpin for Renderer
impl UnsafeUnpin for Renderer
Blanket Implementations§
Source§impl<T, M, S> Animate<T, M> for Swhere
T: Clone + 'static,
S: IntoSignal<T, M>,
impl<T, M, S> Animate<T, M> for Swhere
T: Clone + 'static,
S: IntoSignal<T, M>,
Source§fn transition(self, transition: impl Into<TransitionConfig>) -> Animated<T>
fn transition(self, transition: impl Into<TransitionConfig>) -> Animated<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.