pub struct BlitRenderer { /* private fields */ }Implementations§
Source§impl BlitRenderer
impl BlitRenderer
Sourcepub fn new(context: Arc<GraphicsContext>, target_format: TextureFormat) -> Self
pub fn new(context: Arc<GraphicsContext>, target_format: TextureFormat) -> Self
Create a new blit renderer.
§Arguments
context- The graphics contexttarget_format- The format of the render target (typically the surface format)
Sourcepub fn new_with_options(
context: Arc<GraphicsContext>,
target_format: TextureFormat,
options: BlitOptions,
) -> Self
pub fn new_with_options( context: Arc<GraphicsContext>, target_format: TextureFormat, options: BlitOptions, ) -> Self
Create a new blit renderer with custom options.
Sourcepub fn create_bind_group(&self, texture_view: &TextureView) -> BindGroup
pub fn create_bind_group(&self, texture_view: &TextureView) -> BindGroup
Create a bind group for a texture.
You can cache this bind group if you’re blitting the same texture repeatedly.
Sourcepub fn blit(&self, render_pass: &mut RenderPass<'_>, texture_view: &TextureView)
pub fn blit(&self, render_pass: &mut RenderPass<'_>, texture_view: &TextureView)
Blit a texture to the render target as a fullscreen quad.
§Arguments
render_pass- The render pass to draw totexture_view- The texture to blit
Note: This creates a new bind group each call. For better performance
with frequently-blitted textures, use create_bind_group and blit_with_bind_group.
Sourcepub fn blit_with_bind_group(
&self,
render_pass: &mut RenderPass<'_>,
bind_group: &BindGroup,
)
pub fn blit_with_bind_group( &self, render_pass: &mut RenderPass<'_>, bind_group: &BindGroup, )
Blit using a pre-created bind group.
More efficient than blit when the same texture is blitted multiple times.
Sourcepub fn bind_group_layout(&self) -> &BindGroupLayout
pub fn bind_group_layout(&self) -> &BindGroupLayout
Get the bind group layout for custom pipelines.
Trait Implementations§
Source§impl RenderCapability for BlitRenderer
A renderer for blitting textures to the screen.
impl RenderCapability for BlitRenderer
A renderer for blitting textures to the screen.
This provides an easy way to render a texture as a fullscreen quad, useful for video backgrounds, splash screens, or post-processing effects.
§Example
ⓘ
let blit_renderer = BlitRenderer::new(context);
// In render loop:
blit_renderer.blit(&mut render_pass, &texture_view);Source§fn requirements() -> GpuRequirements
fn requirements() -> GpuRequirements
GPU requirements (features + limits) for this component.
Auto Trait Implementations§
impl Freeze for BlitRenderer
impl !RefUnwindSafe for BlitRenderer
impl Send for BlitRenderer
impl Sync for BlitRenderer
impl Unpin for BlitRenderer
impl !UnwindSafe for BlitRenderer
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
Converts
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>
Converts
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