1 GitHub GPUOpen LibrariesAndSDKs/VulkanMemoryAllocator: Easy To Combine Vulkan Memory Allocation Library
isidradavis397 edited this page 2 weeks ago


Straightforward to integrate Vulkan memory allocation library. It requires a whole lot of boilerplate code, identical to every little thing else in Vulkan, Memory Wave as a result of it is a low-degree and excessive-performance API. There is extra level of indirection: VkDeviceMemory is allocated separately from creating VkBuffer/VkImage they usually have to be sure collectively. Driver must be queried for supported memory heaps and memory varieties. Totally different GPU distributors present various kinds of it. It is strongly recommended to allocate greater chunks of memory and assign parts of them to explicit sources, as there is a limit on maximum variety of memory blocks that can be allotted. 1. Functions that help to choose appropriate and optimal memory kind based mostly on supposed utilization of the memory. Required or most popular traits of the memory are expressed using higher-degree description evaluating to Vulkan flags. Library retains observe of allotted memory blocks, used and unused ranges inside them, finds finest matching unused ranges for new allocations, respects all the foundations of alignment and buffer/picture granularity.


3. Functions that can create a picture/buffer, allocate memory for it and bind them together - multi functional name. Properly-documented - description of all functions and constructions provided, together with chapters that contain normal description and instance code. Thread-safety: Library is designed to be utilized in multithreaded code. Entry to a single system memory block referred by completely different buffers and textures (binding, mapping) is synchronized internally. Memory mapping is reference-counted. Configuration: Fill optionally available members of VmaAllocatorCreateInfo construction to supply custom CPU memory allocator, pointers to Vulkan capabilities and different parameters. Customization and integration with customized engines: Predefine applicable macros to supply your own implementation of all exterior facilities utilized by the library like assert, mutex, atomic. Help for memory mapping, reference-counted internally. Help for persistently mapped memory: Just allocate with acceptable flag and entry the pointer to already mapped memory. Assist for non-coherent memory. Functions that flush/invalidate memory. CoherentAtomSize is revered mechanically.


Help for useful resource aliasing (overlap). Support for sparse binding and sparse residency: Comfort capabilities that allocate or free multiple memory pages at once. Customized memory pools: Create a pool with desired parameters (e.g. fixed or restricted most size) and allocate memory out of it. Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer vogue. Just allow it and it is going to be used automatically by the library. Used internally if available to query for present utilization and budget. If not obtainable, it falls back to an estimation based on memory heap sizes. KHR is routinely added to memory improvement solution allocations where wanted. Set precedence of allocations or customized pools and it is going to be set mechanically utilizing this extension. Public interface in C, in similar convention as Vulkan API. Error dealing with implemented by returning VkResult error codes - same means as in Vulkan.


Interface documented utilizing Doxygen-type comments. Platform-unbiased, however developed and tested on Home windows using Visual Studio. Steady integration setup for Windows and Linux. Used also on Android, MacOS, and other platforms. Fundamental usage of this library is quite simple. Superior options are elective. VkDeviceMemory block is allotted if wanted. 1. An unused area of the memory block is sure to this buffer. VmaAllocation is an object that represents memory assigned to this buffer. It may be queried for parameters like VkDeviceMemory handle and offset. On Home windows it is strongly recommended to use CMake GUI. This robotically handles configuring the include listing. For extra info on utilizing CMake visit the official CMake documentation. The VulkanMemoryAllocator port in vcpkg is saved updated by Microsoft staff members and group contributors. If the version is out of date, please create a problem or pull request on the vcpkg repository. The discharge comes with precompiled binary executable for "VulkanSample" software which contains test suite. Vulkan Samples - official Khronos Vulkan samples.