AllocatorCreateInfo

Struct AllocatorCreateInfo 

Source
pub struct AllocatorCreateInfo<'a> {
    pub flags: AllocatorCreateFlags,
    pub preferred_large_heap_block_size: DeviceSize,
    pub allocation_callbacks: Option<&'a AllocationCallbacks<'a>>,
    pub device_memory_callbacks: Option<&'a VmaDeviceMemoryCallbacks>,
    pub heap_size_limits: &'a [DeviceSize],
    pub vulkan_api_version: u32,
    pub type_external_memory_handle_types: &'a [ExternalMemoryHandleTypeFlagsKHR],
    /* private fields */
}

Fields§

§flags: AllocatorCreateFlags

Flags for created allocator.

§preferred_large_heap_block_size: DeviceSize

Preferred size of a single vk::DeviceMemory block to be allocated from large heaps > 1 GiB. Optional. Set to 0 to use default, which is currently 256 MiB.

§allocation_callbacks: Option<&'a AllocationCallbacks<'a>>

Custom CPU memory allocation callbacks. Optional. When specified, will also be used for all CPU-side memory allocations.

§device_memory_callbacks: Option<&'a VmaDeviceMemoryCallbacks>

Informative callbacks for [vk::AllocateMemory], [vk::FreeMemory]. Optional.

§heap_size_limits: &'a [DeviceSize]

An empty array, or an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap. When it is not empty, it must be an array of [vk::PhysicalDeviceMemoryProperties::memoryHeapCount] elements, defining limit on maximum number of bytes that can be allocated out of particular Vulkan memory heap.

Any of the elements may be equal to VK_WHOLE_SIZE, which means no limit on that heap. This is also the default in case of pHeapSizeLimit = NULL.

If there is a limit defined for a heap:

  • If user tries to allocate more memory from that heap using this allocator, the allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY.
  • If the limit is smaller than heap size reported in VkMemoryHeap::size, the value of this limit will be reported instead when using vmaGetMemoryProperties().

Warning! Using this feature may not be equivalent to installing a GPU with smaller amount of memory, because graphics driver doesn’t necessary fail new allocations with [VK_ERROR_OUT_OF_DEVICE_MEMORY] result when memory capacity is exceeded. It may return success and just silently migrate some device memory blocks to system RAM. This driver behavior can also be controlled using VK_AMD_memory_overallocation_behavior extension.

§vulkan_api_version: u32

Optional. Vulkan version that the application uses. It must be a value in the format as created by macro VK_MAKE_VERSION or a constant like: VK_API_VERSION_1_1, VK_API_VERSION_1_0. The patch version number specified is ignored. Only the major and minor versions are considered. Only versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation. Leaving it initialized to zero is equivalent to VK_API_VERSION_1_0. It must match the Vulkan version used by the application and supported on the selected physical device, so it must be no higher than VkApplicationInfo::apiVersion passed to vkCreateInstance and no higher than VkPhysicalDeviceProperties::apiVersion found on the physical device used.

§type_external_memory_handle_types: &'a [ExternalMemoryHandleTypeFlagsKHR]

Either an empty array or an array of external memory handle types for each Vulkan memory type. If not empty, it must be a pointer to an array of VkPhysicalDeviceMemoryProperties::memoryTypeCount elements, defining external memory handle types of particular Vulkan memory type, to be passed using VkExportMemoryAllocateInfoKHR.

Any of the elements may be equal to 0, which means not to use VkExportMemoryAllocateInfoKHR on this memory type. This is also the default in case of pTypeExternalMemoryHandleTypes = NULL.

Implementations§

Source§

impl<'a> AllocatorCreateInfo<'a>

Source

pub fn new( instance: &'a Instance, device: &'a Device, physical_device: PhysicalDevice, ) -> AllocatorCreateInfo<'a>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.