Trait vulkano::memory::allocator::MemoryAllocator
source · pub unsafe trait MemoryAllocator: DeviceOwned {
fn find_memory_type_index(
&self,
memory_type_bits: u32,
filter: MemoryTypeFilter
) -> Option<u32>;
fn allocate_from_type(
&self,
memory_type_index: u32,
create_info: SuballocationCreateInfo
) -> Result<MemoryAlloc, AllocationCreationError>;
fn allocate(
&self,
create_info: AllocationCreateInfo<'_>
) -> Result<MemoryAlloc, AllocationCreationError>;
}
Expand description
General-purpose memory allocators which allocate from any memory type dynamically as needed.
Required Methods
sourcefn find_memory_type_index(
&self,
memory_type_bits: u32,
filter: MemoryTypeFilter
) -> Option<u32>
fn find_memory_type_index(
&self,
memory_type_bits: u32,
filter: MemoryTypeFilter
) -> Option<u32>
Finds the most suitable memory type index in memory_type_bits
using a filter. Returns
None
if the requirements are too strict and no memory type is able to satisfy them.
sourcefn allocate_from_type(
&self,
memory_type_index: u32,
create_info: SuballocationCreateInfo
) -> Result<MemoryAlloc, AllocationCreationError>
fn allocate_from_type(
&self,
memory_type_index: u32,
create_info: SuballocationCreateInfo
) -> Result<MemoryAlloc, AllocationCreationError>
Allocates memory from a specific memory type.
sourcefn allocate(
&self,
create_info: AllocationCreateInfo<'_>
) -> Result<MemoryAlloc, AllocationCreationError>
fn allocate(
&self,
create_info: AllocationCreateInfo<'_>
) -> Result<MemoryAlloc, AllocationCreationError>
Allocates memory according to requirements.