pub struct TextureBlitter { /* private fields */ }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_DSTusage.
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.
§Arguments
device- ADeviceformat- TheTextureFormatof the texture that will be copied to. This has to have theRENDER_TARGETusage.
Properties of the blitting (such as the BlendState) can be customised by using TextureBlitterBuilder instead.
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- ADeviceencoder- ACommandEncodersource- ATextureViewthat gets copied. The format does not matter.target- ATextureViewthat 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