pub fn from_buffer<B, P>(source: B, dimensions: Dimensions, format: F, queue: Arc<Queue>)
                             -> Result<(Arc<Self>,
                                        CommandBufferExecFuture<NowFuture, AutoCommandBuffer>),
                                       ImageCreationError>
        where B: BufferAccess + TypedBufferAccess<Content = [P]> + 'static + Clone + Send + Sync,
              P: Send + Sync + Clone + 'static,
              F: FormatDesc + AcceptsPixels<P> + 'static + Send + Sync,
              Format: AcceptsPixels<P>
    {
        let usage = ImageUsage {
            transfer_destination: true,
            sampled: true,
            ..ImageUsage::none()
        };
        let layout = ImageLayout::ShaderReadOnlyOptimal;

        let (buffer, init) =
            ImmutableImage::uninitialized(source.device().clone(),
                                          dimensions,
                                          format,
                                          MipmapsCount::One,
                                          usage,
                                          layout,
                                          source.device().active_queue_families())?;

        let cb = AutoCommandBufferBuilder::new(source.device().clone(), queue.family())?
            .copy_buffer_to_image_dimensions(source,
                                             init,
                                             [0, 0, 0],
                                             dimensions.width_height_depth(),
                                             0,
                                             dimensions.array_layers_with_cube(),
                                             0)
            .unwrap()
            .build()
            .unwrap();

        let future = match cb.execute(queue) {
            Ok(f) => f,
            Err(_) => unreachable!(),
        };

        Ok((buffer, future))
    }
/// Construct an ImmutableImage containing a copy of the data in `source`.
///
/// TODO: Support mipmaps
Construct an ImmutableImage containing a copy of the data in `source`.
TODO: Support mipmaps
Construct an ImmutableImage containing a copy of the data in ` source ` . TODO : Support mipmaps
pub fn from_buffer<B, P>(source: B, dimensions: Dimensions, format: F, queue: Arc<Queue>)
                             -> Result<(Arc<Self>,
                                        CommandBufferExecFuture<NowFuture, AutoCommandBuffer>),
                                       ImageCreationError>
        where B: BufferAccess + TypedBufferAccess<Content = [P]> + 'static + Clone + Send + Sync,
              P: Send + Sync + Clone + 'static,
              F: FormatDesc + AcceptsPixels<P> + 'static + Send + Sync,
              Format: AcceptsPixels<P>
    {
        let usage = ImageUsage {
            transfer_destination: true,
            sampled: true,
            ..ImageUsage::none()
        };
        let layout = ImageLayout::ShaderReadOnlyOptimal;
        let (buffer, init) =
            ImmutableImage::uninitialized(source.device().clone(),
                                          dimensions,
                                          format,
                                          MipmapsCount::One,
                                          usage,
                                          layout,
                                          source.device().active_queue_families())?;
        let cb = AutoCommandBufferBuilder::new(source.device().clone(), queue.family())?
            .copy_buffer_to_image_dimensions(source,
                                             init,
                                             [0, 0, 0],
                                             dimensions.width_height_depth(),
                                             0,
                                             dimensions.array_layers_with_cube(),
                                             0)
            .unwrap()
            .build()
            .unwrap();
        let future = match cb.execute(queue) {
            Ok(f) => f,
            Err(_) => unreachable!(),
        };
        Ok((buffer, future))
    }
pub fn from_buffer < B , P > ( source : B , dimensions : Dimensions , format : F , queue : Arc < Queue > ) -> Result < ( Arc < Self > , CommandBufferExecFuture < NowFuture , AutoCommandBuffer > ) , ImageCreationError > where B : BufferAccess + TypedBufferAccess < Content = [ P ] > + ' static + Clone + Send + Sync , P : Send + Sync + Clone + ' static , F : FormatDesc + AcceptsPixels < P > + ' static + Send + Sync , Format : AcceptsPixels < P > { let usage = ImageUsage { transfer_destination : true , sampled : true , .. ImageUsage :: none ( ) } ; let layout = ImageLayout :: ShaderReadOnlyOptimal ; let ( buffer , init ) = ImmutableImage :: uninitialized ( source . device ( ) . clone ( ) , dimensions , format , MipmapsCount :: One , usage , layout , source . device ( ) . active_queue_families ( ) ) ? ; let cb = AutoCommandBufferBuilder :: new ( source . device ( ) . clone ( ) , queue . family ( ) ) ? . copy_buffer_to_image_dimensions ( source , init , [ 0 , 0 , 0 ] , dimensions . width_height_depth ( ) , 0 , dimensions . array_layers_with_cube ( ) , 0 ) . unwrap ( ) . build ( ) . unwrap ( ) ; let future = match cb . execute ( queue ) { Ok ( f ) => f , Err ( _ ) => unreachable ! ( ) , } ; Ok ( ( buffer , future ) ) }
Construct an ImmutableImage containing a copy of the data in `source`.
Construct an ImmutableImage containing a copy of the data in ` source ` .
source
B
dimensions
Dimensions
format
F
queue
Arc<Queue>
source
B
dimensions
Dimensions
format
F
queue
Arc<Queue>