pub struct Frame<'gfx> { /* private fields */ }
Expand description
A frame that can be rendered.
Panics
After Frame::render()
has been invoked, this type will panic if dropped
before either Frame::submit()
or Frame::abort()
are invoked. This
panic is designed to prevent accidentally forgetting to submit a frame to the GPU.q
Implementations§
source§impl Frame<'_>
impl Frame<'_>
sourcepub fn prepare<'gfx>(
&'gfx mut self,
device: &'gfx Device,
queue: &'gfx Queue
) -> Graphics<'gfx>
pub fn prepare<'gfx>( &'gfx mut self, device: &'gfx Device, queue: &'gfx Queue ) -> Graphics<'gfx>
Creates a Graphics
context for this frame that can be used to
prepare graphics for rendering:
Shape::prepare
Texture::prepare
Texture::prepare_partial
CollectedTexture::prepare
Drawing::new_frame
The returned graphics provides access to the various types to update their representation on the GPU so that they can be rendered later.
sourcepub fn render<'gfx, 'pass>(
&'pass mut self,
pass: &RenderPassDescriptor<'pass, '_>,
device: &'gfx Device,
queue: &'gfx Queue
) -> RenderingGraphics<'gfx, 'pass>
pub fn render<'gfx, 'pass>( &'pass mut self, pass: &RenderPassDescriptor<'pass, '_>, device: &'gfx Device, queue: &'gfx Queue ) -> RenderingGraphics<'gfx, 'pass>
Creates a RenderingGraphics
context for this frame which is used to
render previously prepared graphics:
sourcepub fn render_into<'gfx, 'pass>(
&'pass mut self,
texture: &'pass Texture,
load_op: LoadOp<Color>,
graphics: &Graphics<'gfx>
) -> RenderingGraphics<'gfx, 'pass>
pub fn render_into<'gfx, 'pass>( &'pass mut self, texture: &'pass Texture, load_op: LoadOp<Color>, graphics: &Graphics<'gfx> ) -> RenderingGraphics<'gfx, 'pass>
Creates a RenderingGraphics
that renders into texture
for this
frame. The returned context can be used to render previously prepared
graphics:
sourcepub fn submit(self, queue: &Queue) -> Option<SubmissionIndex>
pub fn submit(self, queue: &Queue) -> Option<SubmissionIndex>
Submits all of the commands for this frame to the GPU.
This function does not block for the operations to finish. The returned
wgpu::SubmissionIndex
can be used to block until completion if
desired.
sourcepub fn abort(self)
pub fn abort(self)
Aborts rendering this frame.
If Frame::render()
has been invoked, this function must be used
instead of dropping the frame. This type implements a panic-on-drop to
prevent forgetting to submit the frame to the GPU, and this function
prevents the panic from happening.
Trait Implementations§
Auto Trait Implementations§
impl<'gfx> !RefUnwindSafe for Frame<'gfx>
impl<'gfx> Send for Frame<'gfx>
impl<'gfx> Sync for Frame<'gfx>
impl<'gfx> Unpin for Frame<'gfx>
impl<'gfx> !UnwindSafe for Frame<'gfx>
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
§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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.