pub fn uninitialized<'a, I, M>(
        device: Arc<Device>, dimensions: Dimensions, format: F, mipmaps: M, usage: ImageUsage,
        layout: ImageLayout, queue_families: I)
        -> Result<(Arc<ImmutableImage<F>>, ImmutableImageInitialization<F>), ImageCreationError>
        where F: FormatDesc,
              I: IntoIterator<Item = QueueFamily<'a>>,
              M: Into<MipmapsCount>
    {
        let queue_families = queue_families
            .into_iter()
            .map(|f| f.id())
            .collect::<SmallVec<[u32; 4]>>();

        let (image, mem_reqs) = unsafe {
            let sharing = if queue_families.len() >= 2 {
                Sharing::Concurrent(queue_families.iter().cloned())
            } else {
                Sharing::Exclusive
            };

            UnsafeImage::new(device.clone(),
                             usage,
                             format.format(),
                             dimensions.to_image_dimensions(),
                             1,
                             mipmaps,
                             sharing,
                             false,
                             false)?
        };

        let mem = MemoryPool::alloc_from_requirements(&Device::standard_pool(&device),
                                    &mem_reqs,
                                    AllocLayout::Optimal,
                                    MappingRequirement::DoNotMap,
                                    DedicatedAlloc::Image(&image),
                                    |t| if t.is_device_local() {
                                        AllocFromRequirementsFilter::Preferred
                                    } else {
                                        AllocFromRequirementsFilter::Allowed
                                    })?;
        debug_assert!((mem.offset() % mem_reqs.alignment) == 0);
        unsafe {
            image.bind_memory(mem.memory(), mem.offset())?;
        }

        let view = unsafe {
            UnsafeImageView::raw(&image,
                                 dimensions.to_view_type(),
                                 0 .. image.mipmap_levels(),
                                 0 .. image.dimensions().array_layers())?
        };

        let image = Arc::new(ImmutableImage {
                                 image: image,
                                 view: view,
                                 memory: mem,
                                 dimensions: dimensions,
                                 format: format,
                                 initialized: AtomicBool::new(false),
                                 layout: layout,
                             });

        let init = ImmutableImageInitialization {
            image: image.clone(),
            used: AtomicBool::new(false),
        };

        Ok((image, init))
    }
/// Builds an uninitialized immutable image.
///
/// Returns two things: the image, and a special access that should be used for the initial upload to the image.
Builds an uninitialized immutable image.
Returns two things: the image, and a special access that should be used for the initial upload to the image.
Builds an uninitialized immutable image . Returns two things : the image and a special access that should be used for the initial upload to the image .
pub fn uninitialized<'a, I, M>(
        device: Arc<Device>, dimensions: Dimensions, format: F, mipmaps: M, usage: ImageUsage,
        layout: ImageLayout, queue_families: I)
        -> Result<(Arc<ImmutableImage<F>>, ImmutableImageInitialization<F>), ImageCreationError>
        where F: FormatDesc,
              I: IntoIterator<Item = QueueFamily<'a>>,
              M: Into<MipmapsCount>
    {
        let queue_families = queue_families
            .into_iter()
            .map(|f| f.id())
            .collect::<SmallVec<[u32; 4]>>();
        let (image, mem_reqs) = unsafe {
            let sharing = if queue_families.len() >= 2 {
                Sharing::Concurrent(queue_families.iter().cloned())
            } else {
                Sharing::Exclusive
            };
            UnsafeImage::new(device.clone(),
                             usage,
                             format.format(),
                             dimensions.to_image_dimensions(),
                             1,
                             mipmaps,
                             sharing,
                             false,
                             false)?
        };
        let mem = MemoryPool::alloc_from_requirements(&Device::standard_pool(&device),
                                    &mem_reqs,
                                    AllocLayout::Optimal,
                                    MappingRequirement::DoNotMap,
                                    DedicatedAlloc::Image(&image),
                                    |t| if t.is_device_local() {
                                        AllocFromRequirementsFilter::Preferred
                                    } else {
                                        AllocFromRequirementsFilter::Allowed
                                    })?;
        debug_assert!((mem.offset() % mem_reqs.alignment) == 0);
        unsafe {
            image.bind_memory(mem.memory(), mem.offset())?;
        }
        let view = unsafe {
            UnsafeImageView::raw(&image,
                                 dimensions.to_view_type(),
                                 0 .. image.mipmap_levels(),
                                 0 .. image.dimensions().array_layers())?
        };
        let image = Arc::new(ImmutableImage {
                                 image: image,
                                 view: view,
                                 memory: mem,
                                 dimensions: dimensions,
                                 format: format,
                                 initialized: AtomicBool::new(false),
                                 layout: layout,
                             });
        let init = ImmutableImageInitialization {
            image: image.clone(),
            used: AtomicBool::new(false),
        };
        Ok((image, init))
    }
pub fn uninitialized < ' a , I , M > ( device : Arc < Device > , dimensions : Dimensions , format : F , mipmaps : M , usage : ImageUsage , layout : ImageLayout , queue_families : I ) -> Result < ( Arc < ImmutableImage < F > > , ImmutableImageInitialization < F > ) , ImageCreationError > where F : FormatDesc , I : IntoIterator < Item = QueueFamily < ' a > > , M : Into < MipmapsCount > { let queue_families = queue_families . into_iter ( ) . map ( | f | f . id ( ) ) . collect :: < SmallVec < [ u32 ; 4 ] > > ( ) ; let ( image , mem_reqs ) = unsafe { let sharing = if queue_families . len ( ) >= 2 { Sharing :: Concurrent ( queue_families . iter ( ) . cloned ( ) ) } else { Sharing :: Exclusive } ; UnsafeImage :: new ( device . clone ( ) , usage , format . format ( ) , dimensions . to_image_dimensions ( ) , 1 , mipmaps , sharing , false , false ) ? } ; let mem = MemoryPool :: alloc_from_requirements ( & Device :: standard_pool ( & device ) , & mem_reqs , AllocLayout :: Optimal , MappingRequirement :: DoNotMap , DedicatedAlloc :: Image ( & image ) , | t | if t . is_device_local ( ) { AllocFromRequirementsFilter :: Preferred } else { AllocFromRequirementsFilter :: Allowed } ) ? ; debug_assert ! ( ( mem offset ( ) mem_reqs alignment ) 0 ) ; unsafe { image . bind_memory ( mem . memory ( ) , mem . offset ( ) ) ? ; } let view = unsafe { UnsafeImageView :: raw ( & image , dimensions . to_view_type ( ) , 0 .. image . mipmap_levels ( ) , 0 .. image . dimensions ( ) . array_layers ( ) ) ? } ; let image = Arc :: new ( ImmutableImage { image : image , view : view , memory : mem , dimensions : dimensions , format : format , initialized : AtomicBool :: new ( false ) , layout : layout , } ) ; let init = ImmutableImageInitialization { image : image . clone ( ) , used : AtomicBool :: new ( false ) , } ; Ok ( ( image , init ) ) }
Builds an uninitialized immutable image.
Builds an uninitialized immutable image .
device
Arc<Device>
dimensions
Dimensions
format
F
mipmaps
M
usage
ImageUsage
layout
ImageLayout
queue_families
I
device
Arc<Device>
dimensions
Dimensions
format
F
mipmaps
M
usage
ImageUsage
layout
ImageLayout
queue_families
I