/// Adds a command that copies from a buffer to an image.
Adds a command that copies from a buffer to an image.
Adds a command that copies from a buffer to an image .
pub fn copy_buffer_to_image_dimensions<S, Px>(
        &mut self,
        source: Arc<S>,
        destination: Arc<dyn ImageAccess>,
        offset: [u32; 3],
        size: [u32; 3],
        first_layer: u32,
        num_layers: u32,
        mipmap: u32,
    ) -> Result<&mut Self, CopyBufferImageError>
    where
        S: TypedBufferAccess<Content = [Px]> + 'static,
        Px: Pixel,
    {
        unsafe {
            self.ensure_outside_render_pass()?;
            check_copy_buffer_image(
                self.device(),
                source.as_ref(),
                destination.as_ref(),
                CheckCopyBufferImageTy::BufferToImage,
                offset,
                size,
                first_layer,
                num_layers,
                mipmap,
            )?;
            let copy = UnsafeCommandBufferBuilderBufferImageCopy {
                buffer_offset: 0,
                buffer_row_length: 0,
                buffer_image_height: 0,
                image_aspect: if destination.format().aspects().color {
                    ImageAspect::Color
                } else {
                    unimplemented!()
                },
                image_mip_level: mipmap,
                image_base_array_layer: first_layer,
                image_layer_count: num_layers,
                image_offset: [offset[0] as i32, offset[1] as i32, offset[2] as i32],
                image_extent: size,
            };
            self.inner.copy_buffer_to_image(
                source,
                destination,
                ImageLayout::TransferDstOptimal, // TODO: let choose layout
                iter::once(copy),
            )?;
            Ok(self)
        }
    }
pub fn copy_buffer_to_image_dimensions < S , Px > ( & mut self , source : Arc < S > , destination : Arc < dyn ImageAccess > , offset : [ u32 ; 3 ] , size : [ u32 ; 3 ] , first_layer : u32 , num_layers : u32 , mipmap : u32 , ) -> Result < & mut Self , CopyBufferImageError > where S : TypedBufferAccess < Content = [ Px ] > + ' static , Px : Pixel , { unsafe { self . ensure_outside_render_pass ( ) ? ; check_copy_buffer_image ( self . device ( ) , source . as_ref ( ) , destination . as_ref ( ) , CheckCopyBufferImageTy :: BufferToImage , offset , size , first_layer , num_layers , mipmap , ) ? ; let copy = UnsafeCommandBufferBuilderBufferImageCopy { buffer_offset : 0 , buffer_row_length : 0 , buffer_image_height : 0 , image_aspect : if destination . format ( ) . aspects ( ) . color { ImageAspect :: Color } else { unimplemented ! ( ) } , image_mip_level : mipmap , image_base_array_layer : first_layer , image_layer_count : num_layers , image_offset : [ offset [ 0 ] as i32 , offset [ 1 ] as i32 , offset [ 2 ] as i32 ] , image_extent : size , } ; self . inner . copy_buffer_to_image ( source , destination , ImageLayout :: TransferDstOptimal , // TODO: let choose layout iter :: once ( copy ) , ) ? ; Ok ( self ) } }
Adds a command that copies from a buffer to an image.
Adds a command that copies from a buffer to an image .
&mut self
source
Arc<S>
destination
Arc<dyn ImageAccess>
offset
[u32; 3]
size
[u32; 3]
first_layer
u32
num_layers
u32
mipmap
u32