Clone
1
GitHub - GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator: Simple To Combine Vulkan Memory Allocation Library
Ada Wisewould edited this page 2025-09-16 13:52:03 +00:00


Easy to combine Vulkan memory allocation library. It requires quite a lot of boilerplate code, identical to every thing else in Vulkan, because it's a low-level and high-efficiency API. There is extra stage of indirection: VkDeviceMemory is allocated individually from creating VkBuffer/VkImage and they should be bound collectively. Driver must be queried for supported memory heaps and memory types. Completely different GPU vendors present several types of it. It is recommended to allocate bigger chunks of memory and assign elements of them to explicit sources, as there's a limit on most variety of Memory Wave blocks that may be allotted. 1. Capabilities that assist to choose right and optimal memory type primarily based on supposed usage of the Memory Wave. Required or most well-liked traits of the memory are expressed utilizing increased-stage description evaluating to Vulkan flags. Library retains observe of allocated memory blocks, used and unused ranges inside them, finds greatest matching unused ranges for new allocations, respects all the rules of alignment and buffer/image granularity.
google.com


3. Features that can create a picture/buffer, allocate memory for it and bind them collectively - multi function name. Well-documented - description of all functions and constructions offered, along with chapters that contain normal description and instance code. Thread-safety: Library is designed to be used in multithreaded code. Entry to a single system memory block referred by totally different buffers and textures (binding, mapping) is synchronized internally. Memory mapping is reference-counted. Configuration: Fill elective members of VmaAllocatorCreateInfo structure to supply custom CPU memory allocator, pointers to Vulkan capabilities and different parameters. Customization and integration with customized engines: Predefine acceptable macros to supply your own implementation of all exterior facilities used by the library like assert, mutex, atomic. Assist for memory mapping, reference-counted internally. Help for persistently mapped memory: Simply allocate with applicable flag and access the pointer to already mapped memory. Assist for non-coherent memory. Capabilities that flush/invalidate memory. CoherentAtomSize is respected mechanically.


Assist for useful resource aliasing (overlap). Assist for MemoryWave Guide sparse binding and sparse residency: Convenience capabilities that allocate or free a number of memory pages without delay. Custom memory swimming pools: Create a pool with desired parameters (e.g. fixed or restricted maximum measurement) and allocate memory out of it. Linear allocator: Create a pool with linear algorithm and use it for much quicker allocations and deallocations in free-at-once, stack, double stack, or ring buffer trend. Just allow it and it will likely be used mechanically by the library. Used internally if accessible to question for current usage and budget. If not accessible, it falls again to an estimation primarily based on memory heap sizes. KHR is robotically added to memory allocations where wanted. Set priority of allocations or custom pools and it will be set robotically using this extension. Public interface in C, in similar convention as Vulkan API. Error dealing with applied by returning VkResult error codes - same way as in Vulkan.


Interface documented using Doxygen-model feedback. Platform-unbiased, however developed and tested on Home windows utilizing Visible Studio. Steady integration setup for Home windows and Linux. Used also on Android, MacOS, and other platforms. Primary utilization of this library is very simple. Superior features are optionally available. VkDeviceMemory block is allotted if wanted. 1. An unused region 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 Windows it is suggested to make use of CMake GUI. This routinely handles configuring the embody listing. For more information on utilizing CMake go to the official CMake documentation. The VulkanMemoryAllocator port in vcpkg is saved up to date by Microsoft group members and neighborhood contributors. If the version is out of date, please create a problem or pull request on the vcpkg repository. The release comes with precompiled binary executable for "VulkanSample" application which accommodates check suite. Vulkan Samples - official Khronos Vulkan samples.