/// Adds a command that copies an image to another.
///
/// Copy operations have several restrictions:
///
/// - Copy operations are only allowed on queue families that support transfer, graphics, or
///   compute operations.
/// - The number of samples in the source and destination images must be equal.
/// - The size of the uncompressed element format of the source image must be equal to the
///   compressed element format of the destination.
/// - If you copy between depth, stencil or depth-stencil images, the format of both images
///   must match exactly.
/// - For two-dimensional images, the Z coordinate must be 0 for the image offsets and 1 for
///   the extent. Same for the Y coordinate for one-dimensional images.
/// - For non-array images, the base array layer must be 0 and the number of layers must be 1.
///
/// If `layer_count` is greater than 1, the copy will happen between each individual layer as
/// if they were separate images.
///
/// # Panic
///
/// - Panics if the source or the destination was not created with `device`.
///
Adds a command that copies an image to another.
Copy operations have several restrictions.

Copy operations are only allowed on queue families that support transfer, graphics, or
compute operations.
The number of samples in the source and destination images must be equal.
The size of the uncompressed element format of the source image must be equal to the
compressed element format of the destination.
If you copy between depth, stencil or depth-stencil images, the format of both images
must match exactly.
For two-dimensional images, the Z coordinate must be 0 for the image offsets and 1 for
the extent. Same for the Y coordinate for one-dimensional images.
For non-array images, the base array layer must be 0 and the number of layers must be 1.

If `layer_count` is greater than 1, the copy will happen between each individual layer as
if they were separate images.
Adds a command that copies an image to another . Copy operations have several restrictions . Copy operations are only allowed on queue families that support transfer graphics or compute operations . The number of samples in the source and destination images must be equal . The size of the uncompressed element format of the source image must be equal to the compressed element format of the destination . If you copy between depth stencil or depth - stencil images the format of both images must match exactly . For two - dimensional images the Z coordinate must be 0 for the image offsets and 1 for the extent . Same for the Y coordinate for one - dimensional images . For non - array images the base array layer must be 0 and the number of layers must be 1 . If ` layer_count ` is greater than 1 the copy will happen between each individual layer as if they were separate images .
pub fn copy_image(
        &mut self,
        source: Arc<dyn ImageAccess>,
        source_offset: [i32; 3],
        source_base_array_layer: u32,
        source_mip_level: u32,
        destination: Arc<dyn ImageAccess>,
        destination_offset: [i32; 3],
        destination_base_array_layer: u32,
        destination_mip_level: u32,
        extent: [u32; 3],
        layer_count: u32,
    ) -> Result<&mut Self, CopyImageError> {
        unsafe {
            self.ensure_outside_render_pass()?;
            check_copy_image(
                self.device(),
                source.as_ref(),
                source_offset,
                source_base_array_layer,
                source_mip_level,
                destination.as_ref(),
                destination_offset,
                destination_base_array_layer,
                destination_mip_level,
                extent,
                layer_count,
            )?;
            let source_aspects = source.format().aspects();
            let destination_aspects = destination.format().aspects();
            let copy = UnsafeCommandBufferBuilderImageCopy {
                // TODO: Allowing choosing a subset of the image aspects, but note that if color
                // is included, neither depth nor stencil may.
                aspects: ImageAspects {
                    color: source_aspects.color,
                    depth: !source_aspects.color
                        && source_aspects.depth
                        && destination_aspects.depth,
                    stencil: !source_aspects.color
                        && source_aspects.stencil
                        && destination_aspects.stencil,
                    ..ImageAspects::none()
                },
                source_mip_level,
                destination_mip_level,
                source_base_array_layer,
                destination_base_array_layer,
                layer_count,
                source_offset,
                destination_offset,
                extent,
            };
            // TODO: Allow choosing layouts, but note that only Transfer*Optimal and General are
            // valid.
            self.inner.copy_image(
                source,
                ImageLayout::TransferSrcOptimal,
                destination,
                ImageLayout::TransferDstOptimal,
                iter::once(copy),
            )?;
            Ok(self)
        }
    }
pub fn copy_image ( & mut self , source : Arc < dyn ImageAccess > , source_offset : [ i32 ; 3 ] , source_base_array_layer : u32 , source_mip_level : u32 , destination : Arc < dyn ImageAccess > , destination_offset : [ i32 ; 3 ] , destination_base_array_layer : u32 , destination_mip_level : u32 , extent : [ u32 ; 3 ] , layer_count : u32 , ) -> Result < & mut Self , CopyImageError > { unsafe { self . ensure_outside_render_pass ( ) ? ; check_copy_image ( self . device ( ) , source . as_ref ( ) , source_offset , source_base_array_layer , source_mip_level , destination . as_ref ( ) , destination_offset , destination_base_array_layer , destination_mip_level , extent , layer_count , ) ? ; let source_aspects = source . format ( ) . aspects ( ) ; let destination_aspects = destination . format ( ) . aspects ( ) ; let copy = UnsafeCommandBufferBuilderImageCopy { // TODO: Allowing choosing a subset of the image aspects, but note that if color // is included, neither depth nor stencil may. aspects : ImageAspects { color : source_aspects . color , depth : ! source_aspects . color && source_aspects . depth && destination_aspects . depth , stencil : ! source_aspects . color && source_aspects . stencil && destination_aspects . stencil , .. ImageAspects :: none ( ) } , source_mip_level , destination_mip_level , source_base_array_layer , destination_base_array_layer , layer_count , source_offset , destination_offset , extent , } ; // TODO: Allow choosing layouts, but note that only Transfer*Optimal and General are // valid. self . inner . copy_image ( source , ImageLayout :: TransferSrcOptimal , destination , ImageLayout :: TransferDstOptimal , iter :: once ( copy ) , ) ? ; Ok ( self ) } }
Adds a command that copies an image to another.
Adds a command that copies an image to another .
&mut self
source
Arc<dyn ImageAccess>
source_offset
[i32; 3]
source_base_array_layer
u32
source_mip_level
u32
destination
Arc<dyn ImageAccess>
destination_offset
[i32; 3]
destination_base_array_layer
u32
destination_mip_level
u32
extent
[u32; 3]
layer_count
u32
panic
Panics if the source or the destination was not created with `device`.
Panics if the source or the destination was not created with ` device ` .