tp::MemoryAllocatorSetup struct

Used to configure the device-wide Vulkan Memory Allocator.

Public types

using OutOfMemoryCallback = std::function<bool(MemoryLocation)>
The type of user-provided function callback for in-place handling of out-of-memory situations. It receives the memory location that failed the allocation. The callback should attempt to free some unneeded resources and return true if it did. Tephra will then wait (blocking the allocation) until the memory can be safely released and attempts the allocation again.

Constructors, destructors, conversion operators

MemoryAllocatorSetup(uint64_t preferredLargeHeapBlockSize = 0, VmaDeviceMemoryCallbacks* vmaDeviceMemoryCallbacks = nullptr, OutOfMemoryCallback outOfMemoryCallback = {})

Typedef documentation

using tp::MemoryAllocatorSetup::OutOfMemoryCallback = std::function<bool(MemoryLocation)>

The type of user-provided function callback for in-place handling of out-of-memory situations. It receives the memory location that failed the allocation. The callback should attempt to free some unneeded resources and return true if it did. Tephra will then wait (blocking the allocation) until the memory can be safely released and attempts the allocation again.

Function documentation

tp::MemoryAllocatorSetup::MemoryAllocatorSetup(uint64_t preferredLargeHeapBlockSize = 0, VmaDeviceMemoryCallbacks* vmaDeviceMemoryCallbacks = nullptr, OutOfMemoryCallback outOfMemoryCallback = {})

Parameters
preferredLargeHeapBlockSize The preferred size in bytes of a single memory block to be allocated from large heaps > 1 GiB. Set to 0 to use the VMA default, which is currently 256 MiB.
vmaDeviceMemoryCallbacks Informative callbacks for vkAllocateMemory, vkFreeMemory. See <a href='https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/struct_vma_device_memory_callbacks.html">VmaDeviceMemoryCallbacks
outOfMemoryCallback Callback for in-place handling of out-of-memory situations. It will be called when a requested buffer or image allocation fails.