Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Vulkanmemoryallocator | 2,112 | 16 days ago | 18 | mit | C | |||||
Easy to integrate Vulkan memory allocation library | ||||||||||
D3d12memoryallocator | 590 | a month ago | 2 | mit | C++ | |||||
Easy to integrate memory allocation library for Direct3D 12 | ||||||||||
Rendering_engine_dev_resources | 3 | 4 years ago | ||||||||
Rendering engine development resources. |
Easy to integrate Vulkan memory allocation library.
Documentation: Browse online: Vulkan Memory Allocator (generated from Doxygen-style comments in include/vk_mem_alloc.h)
License: MIT. See LICENSE.txt
Changelog: See CHANGELOG.md
Product page: Vulkan Memory Allocator on GPUOpen
Build status:
Memory allocation and resource (buffer and image) creation in Vulkan is difficult (comparing to older graphics APIs, like D3D11 or OpenGL) for several reasons:
VkDeviceMemory
is allocated separately from creating VkBuffer
/VkImage
and they must be bound together.This library can help game developers to manage memory allocations and resource creation by offering some higher-level functions:
VkDeviceMemory
+ offset + size) to the user.
Additional features:
VmaAllocatorCreateInfo
structure to provide custom CPU memory allocator, pointers to Vulkan functions and other parameters.nonCoherentAtomSize
is respected automatically.VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR
is automatically added to memory allocations where needed.priority
of allocations or custom pools and it will be set automatically using this extension.void* pUserData
and debug char* pName
with each allocation.VkResult
error codes - same way as in Vulkan.Basic usage of this library is very simple. Advanced features are optional. After you created global VmaAllocator
object, a complete code needed to create a buffer may look like this:
VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
bufferInfo.size = 65536;
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_AUTO;
VkBuffer buffer;
VmaAllocation allocation;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
With this one function call:
VkBuffer
is created.VkDeviceMemory
block is allocated if needed.VmaAllocation
is an object that represents memory assigned to this buffer. It can be queried for parameters like VkDeviceMemory
handle and offset.
On Windows it is recommended to use CMake GUI.
Alternatively you can generate/open a Visual Studio from the command line:
# By default CMake picks the newest version of Visual Studio it can use
cmake -S . -B build -D VMA_BUILD_SAMPLES=ON
cmake --open build
On Linux:
cmake -S . -B build
# Since VMA has no source files, you can skip to installation immediately
cmake --install build --prefix build/install
After calling either find_package
or add_subdirectory
simply link the library.
This automatically handles configuring the include directory. Example:
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
target_link_libraries(YourGameEngine PRIVATE GPUOpen::VulkanMemoryAllocator)
For more info on using CMake visit the official CMake documentation.
You can download and install VulkanMemoryAllocator using the vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install vulkan-memory-allocator
The VulkanMemoryAllocator port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
The release comes with precompiled binary executable for "VulkanSample" application which contains test suite. It is compiled using Visual Studio 2019, so it requires appropriate libraries to work, including "MSVCP140.dll", "VCRUNTIME140.dll", "VCRUNTIME140_1.dll". If the launch fails with error message telling about those files missing, please download and install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019, "x64" version.
See Documentation.
Many other projects on GitHub and some game development studios that use Vulkan in their games.