/// Create a new chunk by asking Vulkan for more memory in the given
/// memory_type index.
Create a new chunk by asking Vulkan for more memory in the given
memory_type index.
Create a new chunk by asking Vulkan for more memory in the given memory_type index .
pub fn new(device: &Device, memory_type_index: u32, memory_type: MemoryType)
               -> Result<Chunk, Error>
    {
        use dacite::core::MemoryAllocateInfo;
        let allocate_info = MemoryAllocateInfo {
            allocation_size: CHUNK_SIZE,
            memory_type_index: memory_type_index,
            chain: None,
        };
        let memory = device.allocate_memory(&allocate_info, None)?;
        let mapped_memory = if memory_type.property_flags.contains(
            MemoryPropertyFlags::HOST_VISIBLE)
        {
            Some(memory.map(0, OptionalDeviceSize::WholeSize, Default::default())?)
        } else {
            None
        };
        Ok(Chunk {
            memory: memory,
            mapped_memory: mapped_memory,
            blocks: Vec::new(),
            freelist: Arc::new(RwLock::new(Vec::new())),
            memory_type_index: memory_type_index,
            memory_type: memory_type,
            start_of_perm: CHUNK_SIZE,
            perm_blocks: Vec::new(),
            dirty: Arc::new(AtomicBool::new(false)),
        })
    }
pub fn new ( device : & Device , memory_type_index : u32 , memory_type : MemoryType ) -> Result < Chunk , Error > { use dacite :: core :: MemoryAllocateInfo ; let allocate_info = MemoryAllocateInfo { allocation_size : CHUNK_SIZE , memory_type_index : memory_type_index , chain : None , } ; let memory = device . allocate_memory ( & allocate_info , None ) ? ; let mapped_memory = if memory_type . property_flags . contains ( MemoryPropertyFlags :: HOST_VISIBLE ) { Some ( memory . map ( 0 , OptionalDeviceSize :: WholeSize , Default :: default ( ) ) ? ) } else { None } ; Ok ( Chunk { memory : memory , mapped_memory : mapped_memory , blocks : Vec :: new ( ) , freelist : Arc :: new ( RwLock :: new ( Vec :: new ( ) ) ) , memory_type_index : memory_type_index , memory_type : memory_type , start_of_perm : CHUNK_SIZE , perm_blocks : Vec :: new ( ) , dirty : Arc :: new ( AtomicBool :: new ( false ) ) , } ) }
Create a new chunk by asking Vulkan for more memory in the given
memory_type index.
Create a new chunk by asking Vulkan for more memory in the given memory_type index .
device
&Device
memory_type_index
u32
memory_type
MemoryType