pub struct RenderBundleEncoder<'a> { /* private fields */ }Expand description
Records a reusable sequence of draw calls — build via
WGPUBackend::create_render_bundle_encoder,
record with the same set_pipeline/set_bind_group/set_vertex_buffer/
set_index_buffer/draw/draw_indexed shape as
RenderPass, then
finish into a RenderBundle. Re-executing a bundle
via RenderPass::execute_bundles
is often cheaper than re-recording the same draws by hand every frame —
worth it once you have many draw calls that don’t change pipeline/bind
group/buffers from one frame to the next (static scene geometry, say).
Implementations§
Source§impl<'a> RenderBundleEncoder<'a>
impl<'a> RenderBundleEncoder<'a>
pub fn set_pipeline(&mut self, pipeline: &'a RenderPipeline)
Sourcepub fn set_bind_group(
&mut self,
index: u32,
bind_group: &'a BindGroup,
offsets: &[u32],
)
pub fn set_bind_group( &mut self, index: u32, bind_group: &'a BindGroup, offsets: &[u32], )
offsets is the dynamic-offset slice for any dynamic-offset entries
in this bind group’s layout — see
RenderPass::set_bind_group.
Sourcepub fn set_vertex_buffer(&mut self, slot: u32, buffer: &'a Buffer)
pub fn set_vertex_buffer(&mut self, slot: u32, buffer: &'a Buffer)
Binds buffer in its entirety at vertex slot slot.
Sourcepub fn set_index_buffer(&mut self, buffer: &'a Buffer, format: IndexFormat)
pub fn set_index_buffer(&mut self, buffer: &'a Buffer, format: IndexFormat)
Binds buffer in its entirety as the index buffer.
pub fn draw(&mut self, vertices: Range<u32>, instances: Range<u32>)
pub fn draw_indexed( &mut self, indices: Range<u32>, base_vertex: i32, instances: Range<u32>, )
Sourcepub fn finish(self, label: Option<&str>) -> RenderBundle
pub fn finish(self, label: Option<&str>) -> RenderBundle
Stops recording and returns the replayable RenderBundle.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for RenderBundleEncoder<'a>
impl<'a> !Send for RenderBundleEncoder<'a>
impl<'a> !Sync for RenderBundleEncoder<'a>
impl<'a> !UnwindSafe for RenderBundleEncoder<'a>
impl<'a> Freeze for RenderBundleEncoder<'a>
impl<'a> Unpin for RenderBundleEncoder<'a>
impl<'a> UnsafeUnpin for RenderBundleEncoder<'a>
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<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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more