Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 3.4.0 (2026-??-??)

- Added member `VmaAllocationCreateInfo::minAlignment` (#523).
- Remember to always fully initialize structures with zeros and don't rely on their specific `sizeof` to ensure backward compatibility!
- Function `vmaCreateBufferWithAlignment` is now deprecated.
- Improvements for external memory export & import (#503):
- Added functions `vmaCreateDedicatedBuffer`, `vmaCreateDedicatedImage`, `vmaAllocateDedicatedMemory` offering extra parameter `void* pMemoryAllocateNext`.
- Added function `vmaGetMemoryWin32Handle2` offering extra parameter `VkExternalMemoryHandleTypeFlagBits handleType`.
- Added `VMA_VERSION` macro with library version number (#507).
- Improvements in the algorithm choosing memory type when `VMA_MEMORY_USAGE_AUTO*` is used (#520).
- Fixes for compatibility with C++20 modules on Clang 21 and GCC15 (#513, #514).
- Other fixes and improvements, including compatibility with various platforms and compilers, improvements in documentation, sample application, and tests.

# 3.3.0 (2025-05-12)

Additions to the library API:
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2017-2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,6 +26,7 @@ project(VMA VERSION 3.3.0 LANGUAGES CXX)

add_library(VulkanMemoryAllocator INTERFACE)
add_library(GPUOpen::VulkanMemoryAllocator ALIAS VulkanMemoryAllocator)
add_library(VulkanMemoryAllocator::Headers ALIAS VulkanMemoryAllocator)

target_include_directories(VulkanMemoryAllocator INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017-2025 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2017-2026 Advanced Micro Devices, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions docs/html/allocation_annotation.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="generator" content="Doxygen 1.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Vulkan Memory Allocator: Allocation names and user data</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
Expand Down Expand Up @@ -31,7 +31,7 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
Expand Down Expand Up @@ -80,7 +80,7 @@
<div class="contents">
<div class="textblock"><h1 class="doxsection"><a class="anchor" id="allocation_user_data"></a>
Allocation user data</h1>
<p>You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <span class="tt">void*</span> pointer. You can use it e.g. as a pointer, some handle, index, key, ordinal number or any other value that would associate the allocation with your custom metadata. It is useful to identify appropriate data structures in your engine given <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, e.g. when doing <a class="el" href="defragmentation.html">Defragmentation</a>.</p>
<p>You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <span class="tt">void*</span> pointer. You can use it e.g. as a pointer, some handle, index, key, ordinal number or any other value that would associate the allocation with your custom metadata. It is useful to identify appropriate data structures in your engine given <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, e.g. when doing <a class="el" href="defragmentation.html" title="Defragmentation">Defragmentation</a>.</p>
<div class="fragment"><div class="line">VkBufferCreateInfo bufCreateInfo = ...</div>
<div class="line"> </div>
<div class="line">MyBufferMetadata* pMetadata = CreateBufferMetadata();</div>
Expand All @@ -103,8 +103,8 @@
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(allocator, allocation, &amp;allocInfo);</div>
<div class="line">MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
<div class="ttc" id="agroup__group__alloc_html_ga86dd08aba8633bfa4ad0df2e76481d8b"><div class="ttname"><a href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><div class="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Returns current information about specified allocation.</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html"><div class="ttname"><a href="struct_vma_allocation_info.html">VmaAllocationInfo</a></div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1413</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html_adc507656149c04de7ed95d0042ba2a13"><div class="ttname"><a href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">VmaAllocationInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1460</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html"><div class="ttname"><a href="struct_vma_allocation_info.html">VmaAllocationInfo</a></div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1432</div></div>
<div class="ttc" id="astruct_vma_allocation_info_html_adc507656149c04de7ed95d0042ba2a13"><div class="ttname"><a href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">VmaAllocationInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1479</div></div>
</div><!-- fragment --><p>It can also be changed using function <a class="el" href="group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>.</p>
<p>Values of (non-zero) allocations' <span class="tt">pUserData</span> are printed in JSON report created by <a class="el" href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a> in hexadecimal form.</p>
<h1 class="doxsection"><a class="anchor" id="allocation_names"></a>
Expand All @@ -120,7 +120,7 @@ <h1 class="doxsection"><a class="anchor" id="allocation_names"></a>
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1
</small></address>
</div><!-- doc-content -->
</body>
Expand Down
6 changes: 3 additions & 3 deletions docs/html/annotated.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="generator" content="Doxygen 1.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Vulkan Memory Allocator: Class List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
Expand Down Expand Up @@ -31,7 +31,7 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
Expand Down Expand Up @@ -106,7 +106,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1
</small></address>
</div><!-- doc-content -->
</body>
Expand Down
14 changes: 7 additions & 7 deletions docs/html/choosing_memory_type.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="generator" content="Doxygen 1.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Vulkan Memory Allocator: Choosing memory type</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
Expand Down Expand Up @@ -31,7 +31,7 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
Expand Down Expand Up @@ -123,9 +123,9 @@ <h1 class="doxsection"><a class="anchor" id="choosing_memory_type_usage"></a>
<div class="line"><a class="code hl_function" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &amp;stagingBufferInfo, &amp;stagingAllocInfo, &amp;stagingBuffer, &amp;stagingAllocation, <span class="keyword">nullptr</span>);</div>
<div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5">VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:662</div></div>
<div class="ttc" id="astruct_vma_allocation_create_info_html_add09658ac14fe290ace25470ddd6d41b"><div class="ttname"><a href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">VmaAllocationCreateInfo::flags</a></div><div class="ttdeci">VmaAllocationCreateFlags flags</div><div class="ttdoc">Use VmaAllocationCreateFlagBits enum.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1296</div></div>
</div><!-- fragment --><p>For more examples of creating different kinds of resources, see chapter <a class="el" href="usage_patterns.html">Recommended usage patterns</a>. See also: <a class="el" href="memory_mapping.html">Memory mapping</a>.</p>
</div><!-- fragment --><p>For more examples of creating different kinds of resources, see chapter <a class="el" href="usage_patterns.html" title="Recommended usage patterns">Recommended usage patterns</a>. See also: <a class="el" href="memory_mapping.html" title="Memory mapping">Memory mapping</a>.</p>
<p>Usage values <span class="tt">VMA_MEMORY_USAGE_AUTO*</span> are legal to use only when the library knows about the resource being created by having <span class="tt">VkBufferCreateInfo</span> / <span class="tt">VkImageCreateInfo</span> passed, so they work with functions like: <a class="el" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51" title="Creates a new VkBuffer, allocates and binds memory for it.">vmaCreateBuffer()</a>, <a class="el" href="group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer() but for images.">vmaCreateImage()</a>, <a class="el" href="group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888" title="Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.">vmaFindMemoryTypeIndexForBufferInfo()</a> etc. If you allocate raw memory using function <a class="el" href="group__group__alloc.html#gabf28077dbf82d0908b8acbe8ee8dd9b8" title="General purpose memory allocation.">vmaAllocateMemory()</a>, you have to use other means of selecting memory type, as described below.</p>
<dl class="section note"><dt>Note</dt><dd>Old usage values (<span class="tt">VMA_MEMORY_USAGE_GPU_ONLY</span>, <span class="tt">VMA_MEMORY_USAGE_CPU_ONLY</span>, <span class="tt">VMA_MEMORY_USAGE_CPU_TO_GPU</span>, <span class="tt">VMA_MEMORY_USAGE_GPU_TO_CPU</span>, <span class="tt">VMA_MEMORY_USAGE_CPU_COPY</span>) are still available and work same way as in previous versions of the library for backward compatibility, but they are deprecated.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Old usage values (<span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a></span>) are still available and work same way as in previous versions of the library for backward compatibility, but they are deprecated.</dd></dl>
<h1 class="doxsection"><a class="anchor" id="choosing_memory_type_required_preferred_flags"></a>
Required and preferred flags</h1>
<p>You can specify more detailed requirements by filling members <a class="el" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90" title="Flags that must be set in a Memory Type chosen for an allocation.">VmaAllocationCreateInfo::requiredFlags</a> and <a class="el" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d" title="Flags that preferably should be set in a memory type chosen for an allocation.">VmaAllocationCreateInfo::preferredFlags</a> with a combination of bits from enum <span class="tt">VkMemoryPropertyFlags</span>. For example, if you want to create a buffer that will be persistently mapped on host (so it must be <span class="tt">HOST_VISIBLE</span>) and preferably will also be <span class="tt">HOST_COHERENT</span> and <span class="tt">HOST_CACHED</span>, use following code:</p>
Expand Down Expand Up @@ -165,20 +165,20 @@ <h1 class="doxsection"><a class="anchor" id="choosing_memory_type_explicit_memor
<div class="line"><span class="comment">// ...</span></div>
</div><!-- fragment --><h1 class="doxsection"><a class="anchor" id="choosing_memory_type_custom_memory_pools"></a>
Custom memory pools</h1>
<p>If you allocate from custom memory pool, all the ways of specifying memory requirements described above are not applicable and the aforementioned members of <a class="el" href="struct_vma_allocation_create_info.html" title="Parameters of new VmaAllocation.">VmaAllocationCreateInfo</a> structure are ignored. Memory type is selected explicitly when creating the pool and then used to make all the allocations from that pool. For further details, see <a class="el" href="custom_memory_pools.html">Custom memory pools</a>.</p>
<p>If you allocate from custom memory pool, all the ways of specifying memory requirements described above are not applicable and the aforementioned members of <a class="el" href="struct_vma_allocation_create_info.html" title="Parameters of new VmaAllocation.">VmaAllocationCreateInfo</a> structure are ignored. Memory type is selected explicitly when creating the pool and then used to make all the allocations from that pool. For further details, see <a class="el" href="custom_memory_pools.html" title="Custom memory pools">Custom memory pools</a>.</p>
<h1 class="doxsection"><a class="anchor" id="choosing_memory_type_dedicated_allocations"></a>
Dedicated allocations</h1>
<p>Memory for allocations is reserved out of larger block of <span class="tt">VkDeviceMemory</span> allocated from Vulkan internally. That is the main feature of this whole library. You can still request a separate memory block to be created for an allocation, just like you would do in a trivial solution without using any allocator. In that case, a buffer or image is always bound to that memory at offset 0. This is called a "dedicated allocation". You can explicitly request it by using flag <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f" title="Set this flag if the allocation should have its own memory block.">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>. The library can also internally decide to use dedicated allocation in some cases, e.g.:</p>
<ul>
<li>When the size of the allocation is large.</li>
<li>When <a class="el" href="vk_khr_dedicated_allocation.html">VK_KHR_dedicated_allocation</a> extension is enabled and it reports that dedicated allocation is required or recommended for the resource.</li>
<li>When <a class="el" href="vk_khr_dedicated_allocation.html" title="VK_KHR_dedicated_allocation">VK_KHR_dedicated_allocation</a> extension is enabled and it reports that dedicated allocation is required or recommended for the resource.</li>
<li>When allocation of next big memory block fails due to not enough device memory, but allocation with the exact requested size succeeds. </li>
</ul>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1
</small></address>
</div><!-- doc-content -->
</body>
Expand Down
6 changes: 3 additions & 3 deletions docs/html/classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="generator" content="Doxygen 1.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Vulkan Memory Allocator: Class Index</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
Expand Down Expand Up @@ -31,7 +31,7 @@
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
Expand Down Expand Up @@ -83,7 +83,7 @@
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1
</small></address>
</div><!-- doc-content -->
</body>
Expand Down
Loading