In July 2017 we released first public version of Vulkan Memory Allocator. Since then the library is in ongoing development, got few major releases, one general redesign, and currently at version 2.2.0 it supports many useful features. During that time it has been successfully used in many Vulkan® projects, from amateur and educational experiments to AAA game titles, from Windows® PC through Linux®, MacOS, to mobile platforms like Android.
Direct3D 12 is another explicit graphics API that offers similar set of features and performance as Vulkan. A recommendation to allocate large memory blocks and sub-allocate parts of them for your textures and buffers holds there as well. That’s why today we want to present our new project: D3D12 Memory Allocator. It is another C++ library intended to be a D3D12-equivalent of VMA. The style of its API is adjusted to be similar to DirectX® rather than Vulkan, so it’s easy to learn and integrate into your project.
The initial version 1.0.0 we present here is just the beginning of its development. It provides minimum set of features, but it’s already useful for D3D12 applications and has been successfully integrated in one large game project by a developer whom we already shared the code with. Future development is planned to reach feature-parity with VMA and beyond.
D3D12MA has the following key features:
- Allocates and keeps track of bigger memory heaps, used and unused ranges inside them, finds best matching unused ranges to create new resources there as placed resources.
- Automatically respects alignment requirements for created resources.
- Automatically handles resource heap tier – whether it’s
D3D12_RESOURCE_HEAP_TIER_1
that requires to keep certain classes of resources separate orD3D12_RESOURCE_HEAP_TIER_2
that allows to keep them all together.
Additional features:
- Well-documented – description of all classes and functions provided, along with chapters that contain general description and example code.
- Thread-safety: Library is designed to be used in multithreaded code.
- Configuration: Fill optional members of
ALLOCATOR_DESC
structure to provide custom CPU memory allocator and other parameters. - Customization: Predefine appropriate macros to provide your own implementation of external facilities used by the library, like assert, mutex, and atomic.
You can find the project as D3D12MemoryAllocator repository on GitHub. The repository also includes documentation and a sample application that shows how the library can be used.