pub struct TextureBlitter {
pipeline: RenderPipeline,
bind_group_layout: BindGroupLayout,
sampler: Sampler,
}
Available on crate feature
wgsl
only.Expand description
Texture Blitting (Copying) Utility
Use this if you want to just render/copy texture A to texture B where CommandEncoder::copy_texture_to_texture
would not work because:
- Textures are in incompatible formats.
- Textures are of different sizes.
- Your copy destination is the surface texture and does not have the
COPY_DST
usage.
Fields§
§pipeline: RenderPipeline
§bind_group_layout: BindGroupLayout
§sampler: Sampler
Implementations§
source§impl TextureBlitter
impl TextureBlitter
sourcepub fn new(device: &Device, format: TextureFormat) -> Self
pub fn new(device: &Device, format: TextureFormat) -> Self
Returns a TextureBlitter
with default settings.
sourcepub fn copy(
&self,
device: &Device,
encoder: &mut CommandEncoder,
source: &TextureView,
target: &TextureView,
)
pub fn copy( &self, device: &Device, encoder: &mut CommandEncoder, source: &TextureView, target: &TextureView, )
Copies the data from the source TextureView
to the target TextureView
§Arguments
device
- ADevice
encoder
- ACommandEncoder
source
- ATextureView
that gets copied. The format does not matter.target
- ATextureView
that gets the data copied from thesource
. It has to be the same format as the format specified inTextureBlitter::new
Auto Trait Implementations§
impl Freeze for TextureBlitter
impl !RefUnwindSafe for TextureBlitter
impl Send for TextureBlitter
impl Sync for TextureBlitter
impl Unpin for TextureBlitter
impl !UnwindSafe for TextureBlitter
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