Struct vk_mem_erupt::AllocatorCreateInfo[][src]

pub struct AllocatorCreateInfo {
    pub physical_device: PhysicalDevice,
    pub device: Arc<DeviceLoader>,
    pub instance: Arc<InstanceLoader>,
    pub flags: AllocatorCreateFlags,
    pub preferred_large_heap_block_size: usize,
    pub frame_in_use_count: u32,
    pub heap_size_limits: Option<Vec<DeviceSize>>,
}
Expand description

Description of an Allocator to be created.

Fields

physical_device: PhysicalDevice

Vulkan physical device. It must be valid throughout whole lifetime of created allocator.

device: Arc<DeviceLoader>

Vulkan device. It must be valid throughout whole lifetime of created allocator.

instance: Arc<InstanceLoader>

Vulkan instance. It must be valid throughout whole lifetime of created allocator.

flags: AllocatorCreateFlags

Flags for created allocator.

preferred_large_heap_block_size: usize

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

frame_in_use_count: u32

Maximum number of additional frames that are in use at the same time as current frame.

This value is used only when you make allocations with AllocationCreateFlags::CAN_BECOME_LOST flag.

Such allocations cannot become lost if: allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount

For example, if you double-buffer your command buffers, so resources used for rendering in previous frame may still be in use by the GPU at the moment you allocate resources needed for the current frame, set this value to 1.

If you want to allow any allocations other than used in the current frame to become lost, set this value to 0.

heap_size_limits: Option<Vec<DeviceSize>>

Either empty or an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap.

If not empty, it must contain erupt::vk::PhysicalDeviceMemoryProperties::memory_heap_count 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 erupt::vk::WHOLE_SIZE, which means no limit on that heap. This is also the default in case of an empty slice.

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 erupt::vk::Result::ERROR_OUT_OF_DEVICE_MEMORY.

  • If the limit is smaller than heap size reported in erupt::vk::MemoryHeap::size, the value of this limit will be reported instead when using Allocator::get_memory_properties.

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 erupt::vk::Result::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 the VK_AMD_memory_overallocation_behavior extension.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.